diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-08-17 11:08:36 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-08-17 11:08:36 +0800 |
commit | b55df9c6704750cf129f75e0408a76806a5e80bd (patch) | |
tree | 1ace8b1bd47e0f0ab692d9f7ef9ed3d3b9dfe6f7 /script | |
parent | fcbd75d59b8d1de2b89fc1b9e699ca607f32ad78 (diff) | |
download | lua-language-server-b55df9c6704750cf129f75e0408a76806a5e80bd.zip |
fix
Diffstat (limited to 'script')
-rw-r--r-- | script/core/diagnostics/unused-function.lua | 20 | ||||
-rw-r--r-- | script/core/searcher.lua | 3 |
2 files changed, 15 insertions, 8 deletions
diff --git a/script/core/diagnostics/unused-function.lua b/script/core/diagnostics/unused-function.lua index 523bca6e..8f6ccaac 100644 --- a/script/core/diagnostics/unused-function.lua +++ b/script/core/diagnostics/unused-function.lua @@ -41,14 +41,20 @@ return function (uri, callback) if isToBeClosed(parent) then return false end + await.delay() + if parent.type == 'setlocal' then + parent = parent.node + end + local refs = parent.ref local hasGet - local refs = vm.getRefs(source) - for _, src in ipairs(refs) do - if guide.isGet(src) then - local func = guide.getParentFunction(src) - if not checkFunction(func) then - hasGet = true - break + if refs then + for _, src in ipairs(refs) do + if guide.isGet(src) then + local func = guide.getParentFunction(src) + if not checkFunction(func) then + hasGet = true + break + end end end end diff --git a/script/core/searcher.lua b/script/core/searcher.lua index 973c57a9..2fc24437 100644 --- a/script/core/searcher.lua +++ b/script/core/searcher.lua @@ -305,7 +305,7 @@ local function stop(status, msg) log.warn(msg) if FOOTPRINT then FOOTPRINT = false - log.debug(status.mode) + log.error(status.mode) log.debug(tconcat(status.footprint, '\n')) end return @@ -799,6 +799,7 @@ function m.searchRefsByID(status, suri, expect, mode) local crossed = {} if mode == 'def' or mode == 'alldef' + or mode == 'field' or ignoredIDs[id] or id == 'dn:string' or hasCall(field) then |