Skip to content

Commit bc243c8

Browse files
committed
Merge branch 'master' of github.com:EmmyLua/VSCode-EmmyLua
2 parents db379d1 + 2bd43e9 commit bc243c8

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,11 @@
300300
"default": "",
301301
"description": "%config.misc.executablePath%"
302302
},
303+
"emmylua.misc.globalConfigPath": {
304+
"type": "string",
305+
"default": "",
306+
"description": "%config.misc.globalConfigPath%"
307+
},
303308
"lua.trace.server": {
304309
"type": "string",
305310
"enum": [

package.nls.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616
"debug.launch.newWindow": "create new windows",
1717
"config.autoInsertTripleDash.description": "Automatically insert \"---\" when line breaking after a comment",
1818
"config.misc.executablePath": "Specify the executable file path in VSCode",
19-
"config.develop.port": "Specify the port for the debugger to listen on"
19+
"config.develop.port": "Specify the port for the debugger to listen on",
20+
"config.misc.globalConfigPath": "Specify a path to the global configuration file"
2021
}

package.nls.zh-cn.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@
1515
"debug.launch.newWindow": "emmylua会创建一个新窗口展示这个进程",
1616
"config.autoInsertTripleDash.description": "在注解后换行时自动插入 \"---\"",
1717
"config.misc.executablePath": "VSCode中指定可执行文件路径",
18-
"config.develop.port": "指定开发监听的端口"
19-
}
18+
"config.develop.port": "指定开发监听的端口",
19+
"config.misc.globalConfigPath": "指定全局配置文件的路径"
20+
}
21+

src/extension.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,22 @@ async function doStartServer() {
148148

149149
serverOptions = {
150150
command: configExecutablePath,
151-
args: []
151+
args: [],
152+
options: { env: {} }
152153
};
153154

154155
let parameters = config.get<string[]>("emmylua.ls.startParameters");
155156
if (parameters && parameters.length > 0) {
156157
serverOptions.args = parameters;
157158
}
159+
160+
let globalConfigPath = config.get<string>("emmylua.misc.globalConfigPath")?.trim();
161+
if (globalConfigPath && globalConfigPath.length > 0) {
162+
if (!serverOptions.options || !serverOptions.options.env) {
163+
serverOptions.options = { env: {} }
164+
}
165+
serverOptions.options.env['EMMYLUALS_CONFIG'] = globalConfigPath;
166+
}
158167
}
159168

160169
ctx.client = new LanguageClient(ctx.LANGUAGE_ID, "EmmyLua plugin for vscode.", serverOptions, clientOptions);

0 commit comments

Comments
 (0)