diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-12-16 10:55:34 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-12-16 10:55:34 +0800 |
commit | bc46f33475261f06d1576ce5dca9bc753565b64b (patch) | |
tree | 7ebe27a0afc41e6d24f49dfcfa17462e71ad5d6e /script | |
parent | 4ab165a5940b3e41ea2932b899406d70fb1b964e (diff) | |
download | lua-language-server-bc46f33475261f06d1576ce5dca9bc753565b64b.zip |
close #300
Diffstat (limited to 'script')
-rw-r--r-- | script/core/diagnostics/unused-function.lua | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/script/core/diagnostics/unused-function.lua b/script/core/diagnostics/unused-function.lua index a68b8dcc..e6ae9386 100644 --- a/script/core/diagnostics/unused-function.lua +++ b/script/core/diagnostics/unused-function.lua @@ -4,6 +4,7 @@ local vm = require 'vm' local define = require 'proto.define' local lang = require 'language' local await = require 'await' +local client = require 'provider.client' local function isToBeClosed(source) if not source.attrs then @@ -44,12 +45,21 @@ return function (uri, callback) end end if not hasGet then - callback { - start = source.start, - finish = source.finish, - tags = { define.DiagnosticTag.Unnecessary }, - message = lang.script.DIAG_UNUSED_FUNCTION, - } + if client.isVSCode() then + callback { + start = source.start, + finish = source.finish, + tags = { define.DiagnosticTag.Unnecessary }, + message = lang.script.DIAG_UNUSED_FUNCTION, + } + else + callback { + start = source.keyword[1], + finish = source.keyword[2], + tags = { define.DiagnosticTag.Unnecessary }, + message = lang.script.DIAG_UNUSED_FUNCTION, + } + end end end) end |