Skip to content

Commit 5c089e8

Browse files
committed
前端支持 lua.config 命令,用于修改用户的 settings.json
1 parent 389debe commit 5c089e8

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

client/out/languageserver.js

Lines changed: 17 additions & 0 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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,26 @@ import {
1010
LanguageClientOptions,
1111
ServerOptions,
1212
} from 'vscode-languageclient/node';
13+
import { commands } from 'vscode';
1314

1415
let client: LanguageClient;
1516

17+
function registerCustomCommands(context: ExtensionContext) {
18+
context.subscriptions.push(commands.registerCommand('lua.config', (data) => {
19+
let config = workspace.getConfiguration()
20+
if (data.action == 'add') {
21+
let value: any[] = config.get(data.key);
22+
value.push(data.value);
23+
config.update(data.key, value);
24+
return;
25+
}
26+
if (data.action == 'set') {
27+
config.update(data.key, data.value);
28+
return;
29+
}
30+
}))
31+
}
32+
1633
export function activate(context: ExtensionContext) {
1734
let language = env.language;
1835

@@ -89,6 +106,7 @@ export function activate(context: ExtensionContext) {
89106
);
90107

91108
client.registerProposedFeatures();
109+
registerCustomCommands(context);
92110

93111
patch.patch(client);
94112

server

0 commit comments

Comments
 (0)