From a44ee9b0bb9c363ae2619fe405900f27732cf803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 20 Jun 2024 20:06:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=9B=BA=E5=AE=9A=E7=AB=AF?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 8 ++++++++ src/console/index.ts | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 865f8bf..7e57940 100644 --- a/package.json +++ b/package.json @@ -340,6 +340,14 @@ "type": "boolean", "default": true }, + "Y3-Helper.ServerPort": { + "title": "客户端连接端口", + "description": "使用0表示随机端口", + "type": "number", + "default": 0, + "minimum": 0, + "maximum": 65535 + }, "Y3-Helper.editorTablceDataExcelFolder": { "title": "存放物编数据的Excel表格所在的文件夹的相对路径", "description": "注意:Execl表中的物编数据会按此相对路径下的importRules.mjs代码所实现的导入规则来导入,生成Excel物编数据模板时也会生成到此文件夹下", diff --git a/src/console/index.ts b/src/console/index.ts index 7c5e07e..8728313 100644 --- a/src/console/index.ts +++ b/src/console/index.ts @@ -91,7 +91,10 @@ function registerAllMethods() { export function init() { registerAllMethods(); - let port = randomInt(10000, 65535); + let port: number | undefined = vscode.workspace.getConfiguration('Y3-Helper').get('ServerPort'); + if (port === 0 || typeof port !== 'number') { + port = randomInt(10000, 65535); + } server = new ConsoleServer(port);