diff options
Diffstat (limited to 'script')
-rw-r--r-- | script/core/diagnostics/init.lua | 12 | ||||
-rw-r--r-- | script/provider/diagnostic.lua | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/script/core/diagnostics/init.lua b/script/core/diagnostics/init.lua index 6b14459e..9114371f 100644 --- a/script/core/diagnostics/init.lua +++ b/script/core/diagnostics/init.lua @@ -47,8 +47,9 @@ end ---@async ---@param uri uri ---@param name string +---@param isScopeDiag boolean ---@param response async fun(result: any) -local function check(uri, name, response) +local function check(uri, name, isScopeDiag, response) if config.get(uri, 'Lua.diagnostics.disable')[name] then return end @@ -89,7 +90,9 @@ local function check(uri, name, response) if passed >= 0.5 then log.warn(('Diagnostics [%s] @ [%s] takes [%.3f] sec!'):format(name, uri, passed)) end - checkSleep(uri, passed) + if isScopeDiag then + checkSleep(uri, passed) + end if DIAGTIMES then DIAGTIMES[name] = (DIAGTIMES[name] or 0) + passed end @@ -97,9 +100,10 @@ end ---@async ---@param uri uri +---@param isScopeDiag boolean ---@param response async fun(result: any) ---@param checked async fun(name: string) -return function (uri, response, checked) +return function (uri, isScopeDiag, response, checked) local ast = files.getState(uri) if not ast then return nil @@ -111,7 +115,7 @@ return function (uri, response, checked) for _, name in ipairs(diagList) do await.delay() - check(uri, name, response) + check(uri, name, isScopeDiag, response) checked(name) end end diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua index 0e2fbfde..c01c56b0 100644 --- a/script/provider/diagnostic.lua +++ b/script/provider/diagnostic.lua @@ -237,7 +237,7 @@ function m.doDiagnostic(uri, isScopeDiag) local lastPushClock = os.clock() ---@async - xpcall(core, log.error, uri, function (result) + xpcall(core, log.error, uri, isScopeDiag, function (result) diags[#diags+1] = buildDiagnostic(uri, result) if not isScopeDiag and os.clock() - lastPushClock >= 0.2 then |