Skip to content

Commit 0979092

Browse files
committed
#96 Wrong luacheck cwd is used with --config, by Nexela.
1 parent 9e7176c commit 0979092

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

server/providers/lib/linters.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ class Luacheck {
3131
command(document) {
3232
const settings = this.coder.settings.luacheck;
3333
let args = [];
34+
let luacheckrc_path
3435

3536
if (settings.automaticOption) {
3637
this.automaticOptions(settings, args, document);
3738
} else {
3839
const luacheckrc = path_1.resolve(settings.configFilePath, ".luacheckrc");
3940
if (isFileSync(luacheckrc)) {
4041
args.push('--config', luacheckrc);
42+
luacheckrc_path = path_1.dirname(luacheckrc)
4143
}
4244
}
4345

@@ -46,10 +48,11 @@ class Luacheck {
4648
args.push("--filename", fileName, "-"); //use stdin
4749

4850
let cmd = settings.execPath || default_luacheck_executor;
51+
let cwd = path_1.dirname(luacheckrc_path || fileName);
4952

5053
return {
5154
cmd: cmd,
52-
cwd: path_1.dirname(fileName),
55+
cwd: cwd,
5356
args: args
5457
};
5558
}

0 commit comments

Comments
 (0)