summaryrefslogtreecommitdiff
path: root/script/core/diagnostics/init.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-01-05 21:01:45 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-01-05 21:01:45 +0800
commit36a0e0f40dafdab77dd3df2ead8bceb92e3ae193 (patch)
treeef9ebec7368bc53ade8f4d3a23241c1b2a0c953b /script/core/diagnostics/init.lua
parentd99e03fd46830c31b14646f4ca6344f660059af3 (diff)
downloadlua-language-server-36a0e0f40dafdab77dd3df2ead8bceb92e3ae193.zip
`diagnostics.workspaceRate` only effect workspace
Diffstat (limited to 'script/core/diagnostics/init.lua')
-rw-r--r--script/core/diagnostics/init.lua12
1 files changed, 8 insertions, 4 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