Skip to content

Commit

Permalink
优先使用第一个文件夹的配置
Browse files Browse the repository at this point in the history
  • Loading branch information
sumneko committed Nov 11, 2024
1 parent df9d83e commit 9565033
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -406,21 +406,24 @@
"type": "string",
"default": "",
"ignoreSync": true,
"pattern": "(^.*[\\\\/]Editor.exe$)|(^$)"
"pattern": "(^.*[\\\\/]Editor.exe$)|(^$)",
"scope": "resource"
},
"Y3-Helper.ShowStatusBarItem": {
"title": "显示状态栏按钮",
"description": "在状态栏中显示“启动”和“附加”按钮",
"type": "boolean",
"default": true
"default": true,
"scope": "resource"
},
"Y3-Helper.ServerPort": {
"title": "客户端连接端口",
"description": "使用0表示随机端口",
"type": "number",
"default": 0,
"minimum": 0,
"maximum": 65535
"maximum": 65535,
"scope": "resource"
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/console/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function registerAllMethods() {
export function init() {
registerAllMethods();

let port: number | undefined = vscode.workspace.getConfiguration('Y3-Helper').get('ServerPort');
let port: number | undefined = vscode.workspace.getConfiguration('Y3-Helper', vscode.workspace.workspaceFolders?.[0]).get('ServerPort');
if (port === 0 || typeof port !== 'number') {
port = randomInt(10000, 65535);
}
Expand Down
2 changes: 1 addition & 1 deletion src/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function init(context: vscode.ExtensionContext) {
attach.command = 'y3-helper.attach';

function update_items() {
if (vscode.workspace.getConfiguration('Y3-Helper').get('ShowStatusBarItem')) {
if (vscode.workspace.getConfiguration('Y3-Helper', vscode.workspace.workspaceFolders?.[0]).get('ShowStatusBarItem')) {
launch.show();
attach.show();
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class Env {

private async searchEditorUri(askUser = false): Promise<vscode.Uri | undefined> {
// 先看看设置里有没有
let editorPath: string|undefined = vscode.workspace.getConfiguration('Y3-Helper').get('EditorPath');
let editorPath: string|undefined = vscode.workspace.getConfiguration('Y3-Helper', vscode.workspace.workspaceFolders?.[0]).get('EditorPath');
if (editorPath && await this.isValidEditorPath(editorPath)) {
return vscode.Uri.file(editorPath);
}
Expand Down Expand Up @@ -149,7 +149,7 @@ class Env {
return undefined;
}
if (await this.isValidEditorPath(selectedExe.fsPath)) {
await vscode.workspace.getConfiguration('Y3-Helper').update('EditorPath', selectedExe.fsPath);
await vscode.workspace.getConfiguration('Y3-Helper', vscode.workspace.workspaceFolders?.[0]).update('EditorPath', selectedExe.fsPath);
return selectedExe;
}
}
Expand Down Expand Up @@ -314,7 +314,7 @@ class Env {
* 从插件配置中更新物编数据类型对应的CSV文件保存地址
*/
private initTableTypeToCSVfolderPath(): void {
let csvPathConfig: any = vscode.workspace.getConfiguration('Y3-Helper.CSVPath');
let csvPathConfig: any = vscode.workspace.getConfiguration('Y3-Helper.CSVPath', vscode.workspace.workspaceFolders?.[0]);
//console.log(vscode.workspace.getConfiguration('Y3-Helper.CSVPath').unit);
for (const [key, value] of Object.entries(Template.path.csv)) {
this._tableTypeToCSVfolderPath[key] = csvPathConfig[key] ?? value;
Expand Down

0 comments on commit 9565033

Please sign in to comment.