diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-06-18 18:46:39 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-06-18 18:46:39 +0800 |
commit | 805d1c96d07c42a6247b1408395d87df763139c1 (patch) | |
tree | d1a975d110e74077aafd546594435747d773f3e3 | |
parent | 881fab2e2bb5b935da5354d501972881a7777605 (diff) | |
download | lua-language-server-805d1c96d07c42a6247b1408395d87df763139c1.zip |
cleanup
-rw-r--r-- | script/core/noder.lua | 5 | ||||
-rw-r--r-- | script/core/searcher.lua | 18 | ||||
-rw-r--r-- | test.lua | 2 | ||||
-rw-r--r-- | test/definition/bug.lua | 8 |
4 files changed, 20 insertions, 13 deletions
diff --git a/script/core/noder.lua b/script/core/noder.lua index 7a1733de..8fd7603c 100644 --- a/script/core/noder.lua +++ b/script/core/noder.lua @@ -109,7 +109,7 @@ local function getKey(source) elseif source.type == 'function' then return source.start, nil elseif source.type == 'string' then - return '', nil + return source.start, nil elseif source.type == 'integer' or source.type == 'number' or source.type == 'boolean' @@ -532,6 +532,9 @@ function m.compileNode(noders, source) local node = getNode(noders, id) node.skip = true end + if source.type == 'string' then + pushForward(noders, id, 'str:') + end -- self -> mt:xx if source.type == 'local' and source[1] == 'self' then local func = guide.getParentFunction(source) diff --git a/script/core/searcher.lua b/script/core/searcher.lua index 79e80577..839417fd 100644 --- a/script/core/searcher.lua +++ b/script/core/searcher.lua @@ -445,16 +445,14 @@ function m.searchRefsByID(status, uri, expect, mode) end end - local function checkSpecial(id, node, field) + local function checkSpecial(id, field) -- Special rule: ('').XX -> stringlib.XX if id == 'str:' or id == 'dn:string' then if field or mode == 'field' then searchID('dn:stringlib', field) end - return true end - return false end local function checkRequire(requireName, field) @@ -556,14 +554,11 @@ function m.searchRefsByID(status, uri, expect, mode) checkRequire(node.require, field) end - local isSepcial = checkSpecial(id, node, field) - if not isSepcial then - if node.forward then - checkForward(id, node, field) - end - if node.backward then - checkBackward(id, node, field) - end + if node.forward then + checkForward(id, node, field) + end + if node.backward then + checkBackward(id, node, field) end if node.sources then @@ -631,6 +626,7 @@ function m.searchRefsByID(status, uri, expect, mode) return end end + checkSpecial(id, field) local node = noder.getNodeByID(root, id) if node then searchNode(id, node, field) @@ -9,7 +9,7 @@ local fs = require 'bee.filesystem' ROOT = fs.path(rootPath) TEST = true DEVELOP = true -FOOTPRINT = true +TRACE = true LOGPATH = LOGPATH or (ROOT .. '/log') METAPATH = METAPATH or (ROOT .. '/meta') diff --git a/test/definition/bug.lua b/test/definition/bug.lua index 6d716471..fbc2b6a8 100644 --- a/test/definition/bug.lua +++ b/test/definition/bug.lua @@ -234,3 +234,11 @@ TEST [[ g[a.b.c] = 1 print(g.<?x?>) ]] + +TEST [[ +local function f() + return '' +end + +local <?<!s!>?> = '' +]] |