Skip to content

Commit 9187442

Browse files
committed
Improve lua-lanuageserver --check
Original #2775 only pass exe, which is arg[minIndex]. arg from minIndex + 1 to -1 are ignored. For example, when arg from -3 to 2 is /the/path/of/bootstrap -e XXX lua-language-server --check . It will only pass /the/path/of/bootstrap lua-language-server --check .
1 parent 24b9faa commit 9187442

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

script/cli/check.lua

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ local function logFileForThread(threadId)
1111
return LOGPATH .. '/check-partial-' .. threadId .. '.json'
1212
end
1313

14-
local function buildArgs(exe, numThreads, threadId, format, quiet)
15-
local args = {exe}
14+
local function buildArgs(minIndex, numThreads, threadId, format, quiet)
15+
local args = {}
1616
local skipNext = false
17-
for i = 1, #arg do
17+
for i = minIndex, #arg do
1818
local arg = arg[i]
1919
-- --check needs to be transformed into --check_worker
2020
if arg:lower():match('^%-%-check$') or arg:lower():match('^%-%-check=') then
@@ -56,9 +56,10 @@ function export.runCLI()
5656
exe = arg[minIndex]
5757
minIndex = minIndex - 1
5858
end
59+
minIndex = minIndex + 1
5960
-- TODO: is this necessary? got it from the shell.lua helper in bee.lua tests
6061
if platform.os == 'windows' and not exe:match('%.[eE][xX][eE]$') then
61-
exe = exe..'.exe'
62+
arg[minIndex] = exe..'.exe'
6263
end
6364

6465
if not QUIET and numThreads > 1 then
@@ -67,7 +68,7 @@ function export.runCLI()
6768

6869
local procs = {}
6970
for i = 1, numThreads do
70-
local process, err = subprocess.spawn({buildArgs(exe, numThreads, i, CHECK_FORMAT, QUIET)})
71+
local process, err = subprocess.spawn({buildArgs(minIndex, numThreads, i, CHECK_FORMAT, QUIET)})
7172
if err then
7273
print(err)
7374
end

0 commit comments

Comments
 (0)