diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-06-11 19:48:00 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-06-11 19:48:00 +0800 |
commit | 10a999ff48d18737be710c1308d829b27f9487ae (patch) | |
tree | 6b5240d985e6b2cb9592c80d04a3c41c21e6d025 /script/core | |
parent | d587d5c381c9cf8c59fb6aa0caf26fc7288ed550 (diff) | |
download | lua-language-server-10a999ff48d18737be710c1308d829b27f9487ae.zip |
cleanup
Diffstat (limited to 'script/core')
-rw-r--r-- | script/core/searcher.lua | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/script/core/searcher.lua b/script/core/searcher.lua index 0d59932d..4db87e15 100644 --- a/script/core/searcher.lua +++ b/script/core/searcher.lua @@ -519,6 +519,25 @@ function m.searchRefsByID(status, uri, expect, mode) end end + local function checkAnyField(id, field) + if mode == 'ref' then + return + end + local lastID = noder.getLastID(id) + if not lastID then + return + end + local originField = id:sub(#lastID + 1) + if originField == noder.TABLE_KEY then + return + end + local anyFieldID = lastID .. noder.ANY_FIELD + local anyFieldNode = noder.getNodeByID(root, anyFieldID) + if anyFieldNode then + searchNode(anyFieldID, anyFieldNode, field) + end + end + local stepCount = 0 function searchStep(id, field) stepCount = stepCount + 1 @@ -541,19 +560,8 @@ function m.searchRefsByID(status, uri, expect, mode) end checkGlobal(id, node, field) checkClass(id, node, field) - local lastID = checkLastID(id, field) - if not lastID then - return - end - local originField = id:sub(#lastID + 1) - if originField == noder.TABLE_KEY then - return - end - local anyFieldID = lastID .. noder.ANY_FIELD - local anyFieldNode = noder.getNodeByID(root, anyFieldID) - if anyFieldNode then - searchNode(anyFieldID, anyFieldNode, field) - end + checkLastID(id, field) + checkAnyField(id, field) end search(expect) |