LuaCoderAssist
LuaCoderAssist copied to clipboard
Wrong luacheck cwd is used with --config
When a .luacheckrc file is automaticly detected it passes the cwd of the file. In this case the cwd of the .luacheckrc file should be used.
This rough js change allows it to work correctly
class Luacheck {
constructor(coder) {
this.coder = coder;
}
command(document) {
const settings = this.coder.settings.luacheck;
let args = [];
let luacheckrc_path
if (settings.automaticOption) {
this.automaticOptions(settings, args, document);
} else {
const luacheckrc = path_1.resolve(settings.configFilePath, ".luacheckrc");
if (isFileSync(luacheckrc)) {
args.push('--config', luacheckrc);
luacheckrc_path = path_1.dirname(luacheckrc)
}
}
args.push(...defaultOpt);
const fileName = uri_1.parse(document.uri).fsPath;
args.push("--filename", fileName, "-"); //use stdin
let cmd = settings.execPath || default_luacheck_executor;
let cwd = path_1.dirname(luacheckrc_path || fileName);
return {
cmd: cmd,
cwd: cwd,
args: args
};
}
@Nexela thank you for your feedback, this will be fixed the next release.