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 | |
parent | d587d5c381c9cf8c59fb6aa0caf26fc7288ed550 (diff) | |
download | lua-language-server-10a999ff48d18737be710c1308d829b27f9487ae.zip |
cleanup
-rw-r--r-- | script/core/searcher.lua | 34 | ||||
-rw-r--r-- | test.lua | 2 | ||||
-rw-r--r-- | test/references/init.lua | 2 |
3 files changed, 24 insertions, 14 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) @@ -89,6 +89,8 @@ local function main() --config.config.intelliSense.searchDepth = 5 loadDocMetas() + test 'full' + require 'bee.platform'.OS = 'Windows' testAll() require 'bee.platform'.OS = 'Linux' diff --git a/test/references/init.lua b/test/references/init.lua index 237e41da..fbbd3227 100644 --- a/test/references/init.lua +++ b/test/references/init.lua @@ -158,7 +158,7 @@ local y = f()() TEST [[ local t = {} t.<?x?> = 1 -t[<!a.b.c!>] = 1 +t[a.b.c] = 1 ]] TEST [[ |