From 9187442ee6244c9a7c9a289c95a7caa91a5af771 Mon Sep 17 00:00:00 2001 From: "Wu, Zhenyu" Date: Thu, 21 Aug 2025 01:38:49 +0800 Subject: [PATCH] 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 . --- script/cli/check.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/script/cli/check.lua b/script/cli/check.lua index d65c93580..e8c35f602 100644 --- a/script/cli/check.lua +++ b/script/cli/check.lua @@ -11,10 +11,10 @@ local function logFileForThread(threadId) return LOGPATH .. '/check-partial-' .. threadId .. '.json' end -local function buildArgs(exe, numThreads, threadId, format, quiet) - local args = {exe} +local function buildArgs(minIndex, numThreads, threadId, format, quiet) + local args = {} local skipNext = false - for i = 1, #arg do + for i = minIndex, #arg do local arg = arg[i] -- --check needs to be transformed into --check_worker if arg:lower():match('^%-%-check$') or arg:lower():match('^%-%-check=') then @@ -56,9 +56,10 @@ function export.runCLI() exe = arg[minIndex] minIndex = minIndex - 1 end + minIndex = minIndex + 1 -- TODO: is this necessary? got it from the shell.lua helper in bee.lua tests if platform.os == 'windows' and not exe:match('%.[eE][xX][eE]$') then - exe = exe..'.exe' + arg[minIndex] = exe..'.exe' end if not QUIET and numThreads > 1 then @@ -67,7 +68,7 @@ function export.runCLI() local procs = {} for i = 1, numThreads do - local process, err = subprocess.spawn({buildArgs(exe, numThreads, i, CHECK_FORMAT, QUIET)}) + local process, err = subprocess.spawn({buildArgs(minIndex, numThreads, i, CHECK_FORMAT, QUIET)}) if err then print(err) end