diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-11-05 21:55:17 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-11-05 21:55:17 +0800 |
commit | fb5ce900c0f09f5de2e3d8251da6bde09d4a1c71 (patch) | |
tree | ab792a724230f69a696aa9fb2e90b6c601698350 /server-beta/src/core | |
parent | 30a88ee1b1f60e657393a16e55cddae9cb01a62a (diff) | |
download | lua-language-server-fb5ce900c0f09f5de2e3d8251da6bde09d4a1c71.zip |
更新诊断
Diffstat (limited to 'server-beta/src/core')
-rw-r--r-- | server-beta/src/core/diagnostics/init.lua | 2 | ||||
-rw-r--r-- | server-beta/src/core/diagnostics/redundant-value.lua | 24 |
2 files changed, 18 insertions, 8 deletions
diff --git a/server-beta/src/core/diagnostics/init.lua b/server-beta/src/core/diagnostics/init.lua index 69815003..8b6167cc 100644 --- a/server-beta/src/core/diagnostics/init.lua +++ b/server-beta/src/core/diagnostics/init.lua @@ -11,7 +11,7 @@ local function check(uri, name, level, results) result.level = level or result.level result.code = name results[#results+1] = result - end) + end, name) end return function (uri) diff --git a/server-beta/src/core/diagnostics/redundant-value.lua b/server-beta/src/core/diagnostics/redundant-value.lua index 71749f56..be483448 100644 --- a/server-beta/src/core/diagnostics/redundant-value.lua +++ b/server-beta/src/core/diagnostics/redundant-value.lua @@ -1,14 +1,24 @@ -local files = require 'files' -local guide = require 'parser.guide' +local files = require 'files' +local define = require 'proto.define' +local lang = require 'language' -local function check(source) - -end - -return function (uri, callback) +return function (uri, callback, code) local ast = files.getAst(uri) if not ast 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 end |