refactor: 移除 VSCode 设置中的配置项,使用预配置的默认值
This commit is contained in:
@ -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<string>("backendUrl", DEFAULT_CONFIG.backendUrl),
|
||||
timeout: config.get<number>("timeout", DEFAULT_CONFIG.timeout),
|
||||
userId: config.get<string>("userId", DEFAULT_CONFIG.userId),
|
||||
};
|
||||
return { ...DEFAULT_CONFIG };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user