Skip to content

Commit 76a70da

Browse files
committed
fix multi configs of prop
1 parent 2913326 commit 76a70da

File tree

3 files changed

+26
-11
lines changed

3 files changed

+26
-11
lines changed

.vscode/tasks.json

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@
3939
"cwd": "${workspaceFolder}/server"
4040
},
4141
"problemMatcher": [],
42-
"group": {
43-
"kind": "build",
44-
"isDefault": true
45-
}
42+
"group": "build"
4643
},
4744
{
4845
"label": "Install",
@@ -73,6 +70,18 @@
7370
"${command:extensionPath}"
7471
]
7572
}
73+
},
74+
{
75+
"type": "typescript",
76+
"tsconfig": "client/tsconfig.json",
77+
"problemMatcher": [
78+
"$tsc"
79+
],
80+
"group": {
81+
"kind": "build",
82+
"isDefault": true
83+
},
84+
"label": "tsc: 构建 - client/tsconfig.json"
7685
}
7786
]
78-
}
87+
}

client/out/languageserver.js

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/src/languageserver.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ type HintResult = {
3232

3333
function registerCustomCommands(context: ExtensionContext) {
3434
context.subscriptions.push(Commands.registerCommand('lua.config', (changes) => {
35+
let propMap: Map<string, Map<string, any>> = new Map();
3536
for (const data of changes) {
3637
let config = Workspace.getConfiguration(undefined, Uri.parse(data.uri));
3738
if (data.action == 'add') {
@@ -45,9 +46,11 @@ function registerCustomCommands(context: ExtensionContext) {
4546
continue;
4647
}
4748
if (data.action == 'prop') {
48-
let value: Map<string, any> = config.get(data.key);
49-
value[data.prop] = data.value;
50-
config.update(data.key, value, data.global);
49+
if (!propMap[data.key]) {
50+
propMap[data.key] = config.get(data.key);
51+
}
52+
propMap[data.key][data.prop] = data.value;
53+
config.update(data.key, propMap[data.key], data.global);
5154
continue;
5255
}
5356
}

0 commit comments

Comments
 (0)