diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-03 09:53:58 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-03 09:53:58 +0800 |
commit | 6a0b50e2ca3f4c27961618d118181a3959333171 (patch) | |
tree | 19d52ef2b5efa9d708b54637c51dcffce1e209a9 /script-beta | |
parent | d8b0166678abc66c6f66b78fb2ed9b87c682beee (diff) | |
download | lua-language-server-6a0b50e2ca3f4c27961618d118181a3959333171.zip |
整理代码
Diffstat (limited to 'script-beta')
-rw-r--r-- | script-beta/core/diagnostics/init.lua | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/script-beta/core/diagnostics/init.lua b/script-beta/core/diagnostics/init.lua index bd51ce51..a6b61e12 100644 --- a/script-beta/core/diagnostics/init.lua +++ b/script-beta/core/diagnostics/init.lua @@ -16,11 +16,15 @@ table.sort(diagList, function (a, b) return (diagLevel[a] or 0) < (diagLevel[b] or 0) end) -local function check(uri, name, level, results) +local function check(uri, name, results) if config.config.diagnostics.disable[name] then return end - level = config.config.diagnostics.severity[name] or level + local level = config.config.diagnostics.severity[name] + or define.DiagnosticDefaultSeverity[name] + if level == 'Hint' and not files.isOpen(uri) then + return + end local severity = define.DiagnosticSeverity[level] local clock = os.clock() require('core.diagnostics.' .. name)(uri, function (result) @@ -44,14 +48,9 @@ return function (uri, response) local isOpen = files.isOpen(uri) for _, name in ipairs(diagList) do - local level = define.DiagnosticDefaultSeverity[name] - if not isOpen and level == 'Hint' then - goto CONTINUE - end await.delay() local results = {} - check(uri, name, level, results) + check(uri, name, results) response(results) - ::CONTINUE:: end end |