From ef2159f1bd6503a3c10dceef21d176010eadf83d Mon Sep 17 00:00:00 2001 From: Roe-xin Date: Wed, 31 Dec 2025 10:42:53 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=20VSCode=20?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=AD=E7=9A=84=E9=85=8D=E7=BD=AE=E9=A1=B9?= =?UTF-8?q?=EF=BC=8C=E4=BD=BF=E7=94=A8=E9=A2=84=E9=85=8D=E7=BD=AE=E7=9A=84?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 22 +--------------------- src/config/settings.ts | 13 ++++--------- 2 files changed, 5 insertions(+), 30 deletions(-) diff --git a/package.json b/package.json index c6a416a..9f6fe4f 100644 --- a/package.json +++ b/package.json @@ -70,27 +70,7 @@ "id": "iccoder", "label": "IC Coder" } - ], - "configuration": { - "title": "IC Coder", - "properties": { - "icCoder.backendUrl": { - "type": "string", - "default": "http://192.168.1.108:2233", - "description": "后端服务地址" - }, - "icCoder.timeout": { - "type": "number", - "default": 60000, - "description": "请求超时时间(毫秒)" - }, - "icCoder.userId": { - "type": "string", - "default": "default-user", - "description": "用户ID(临时配置)" - } - } - } + ] }, "scripts": { "vscode:prepublish": "pnpm run package", diff --git a/src/config/settings.ts b/src/config/settings.ts index 8b6e490..15ce17d 100644 --- a/src/config/settings.ts +++ b/src/config/settings.ts @@ -1,6 +1,6 @@ /** * 配置管理 - * 从 VSCode 设置读取配置项 + * 后端地址已预配置,用户无需手动设置 */ import * as vscode from "vscode"; @@ -14,7 +14,7 @@ export interface IccoderConfig { userId: string; } -/** 默认配置 */ +/** 默认配置(预配置,不暴露给用户) */ const DEFAULT_CONFIG: IccoderConfig = { backendUrl: "http://192.168.1.108:2233", timeout: 60000, @@ -23,15 +23,10 @@ const DEFAULT_CONFIG: IccoderConfig = { /** * 获取配置项 + * 直接返回预配置的值,用户无需手动配置 */ export function getConfig(): IccoderConfig { - const config = vscode.workspace.getConfiguration("icCoder"); - - return { - backendUrl: config.get("backendUrl", DEFAULT_CONFIG.backendUrl), - timeout: config.get("timeout", DEFAULT_CONFIG.timeout), - userId: config.get("userId", DEFAULT_CONFIG.userId), - }; + return { ...DEFAULT_CONFIG }; } /**