diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-09-22 17:41:25 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-09-22 17:41:25 +0800 |
commit | c951f3472628bdccdbf13a6bd95bc36cc93523fd (patch) | |
tree | 1b54015d40483b573e981678f06859e3e709c929 /script/core/diagnostics/redundant-value.lua | |
parent | 32aa2dac835a0c74b82b19d83d9fd06be7a947ce (diff) | |
download | lua-language-server-c951f3472628bdccdbf13a6bd95bc36cc93523fd.zip |
update
Diffstat (limited to 'script/core/diagnostics/redundant-value.lua')
-rw-r--r-- | script/core/diagnostics/redundant-value.lua | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/script/core/diagnostics/redundant-value.lua b/script/core/diagnostics/redundant-value.lua index d6cd97a7..4c913330 100644 --- a/script/core/diagnostics/redundant-value.lua +++ b/script/core/diagnostics/redundant-value.lua @@ -1,24 +1,24 @@ local files = require 'files' local define = require 'proto.define' local lang = require 'language' +local guide = require 'parser.guide' +local await = require 'await' -return function (uri, callback, code) - local ast = files.getState(uri) - if not ast then +return function (uri, callback) + local state = files.getState(uri) + if not state then return end - local diags = ast.diags[code] - if not diags then - return - end - - for _, info in ipairs(diags) do - callback { - start = info.start, - finish = info.finish, - tags = { define.DiagnosticTag.Unnecessary }, - message = lang.script('DIAG_OVER_MAX_VALUES', info.max, info.passed) - } - end + guide.eachSource(state.ast, function (src) + await.delay() + if src.redundant then + callback { + start = src.start, + finish = src.finish, + tags = { define.DiagnosticTag.Unnecessary }, + message = lang.script('DIAG_OVER_MAX_VALUES', src.redundant.max, src.redundant.passed) + } + end + end) end |