diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-23 18:33:31 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-23 18:33:31 +0800 |
commit | f1e6d2b134af4f44ecbd5a7d8c465ccce6d36939 (patch) | |
tree | d63d0ba58e952df366b561e08ad8fe95e9dbb16d /script/core/diagnostics | |
parent | df7487ab0ad9729082bbc71e03070cde3c2046e4 (diff) | |
download | lua-language-server-f1e6d2b134af4f44ecbd5a7d8c465ccce6d36939.zip |
stage
Diffstat (limited to 'script/core/diagnostics')
-rw-r--r-- | script/core/diagnostics/undefined-global.lua | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/script/core/diagnostics/undefined-global.lua b/script/core/diagnostics/undefined-global.lua index 778fc1f1..c07c3570 100644 --- a/script/core/diagnostics/undefined-global.lua +++ b/script/core/diagnostics/undefined-global.lua @@ -3,6 +3,7 @@ local vm = require 'vm' local lang = require 'language' local config = require 'config' local guide = require 'parser.guide' +local define = require 'proto.define' return function (uri, callback) local ast = files.getAst(uri) @@ -19,22 +20,39 @@ return function (uri, callback) if config.config.diagnostics.globals[key] then return end - if #vm.getGlobalSets(guide.getKeyName(src)) > 0 then + if #vm.getGlobalSets(guide.getKeyName(src)) == 0 then + local message = lang.script('DIAG_UNDEF_GLOBAL', key) + callback { + start = src.start, + finish = src.finish, + message = message, + } return end - local message = lang.script('DIAG_UNDEF_GLOBAL', key) - -- TODO check other version - local otherVersion - local customVersion - if otherVersion then - message = ('%s(%s)'):format(message, lang.script('DIAG_DEFINED_VERSION', table.concat(otherVersion, '/'), config.config.runtime.version)) - elseif customVersion then - message = ('%s(%s)'):format(message, lang.script('DIAG_DEFINED_CUSTOM', table.concat(customVersion, '/'))) + if not vm.isDeprecated(src, 'deep') then + return end + + do return end + callback { start = src.start, finish = src.finish, - message = message, + tags = { define.DiagnosticTag.Deprecated }, + message = 'adsad', } + + do return end + + local defs = vm.getDefs(src, 'deep') + local versions = {} + for _, def in ipairs(defs) do + + end + -- TODO check other version + local otherVersion + if otherVersion then + message = ('%s(%s)'):format(message, lang.script('DIAG_DEFINED_VERSION', table.concat(otherVersion, '/'), config.config.runtime.version)) + end end) end |