summaryrefslogtreecommitdiff
path: root/script/core/searcher.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-06-01 15:23:55 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-06-01 15:23:55 +0800
commit7360b34f9a6f9bf51a5843b065431f7f4eeef42b (patch)
tree6600bbc267ebd4e632a9b457714b0c9bc0b540b9 /script/core/searcher.lua
parentfea133554b47ac6aef9a55d53e3f694311b10fcd (diff)
downloadlua-language-server-7360b34f9a6f9bf51a5843b065431f7f4eeef42b.zip
generic cross files
Diffstat (limited to 'script/core/searcher.lua')
-rw-r--r--script/core/searcher.lua17
1 files changed, 12 insertions, 5 deletions
diff --git a/script/core/searcher.lua b/script/core/searcher.lua
index 9208032c..121e90c6 100644
--- a/script/core/searcher.lua
+++ b/script/core/searcher.lua
@@ -349,7 +349,12 @@ function m.searchRefsByID(status, uri, expect, mode)
local function checkForward(id, node, field)
for _, forwardID in ipairs(node.forward) do
- searchID(forwardID, field)
+ local targetUri, targetID = noder.getUriAndID(forwardID)
+ if targetUri and not files.eq(targetUri, uri) then
+ crossSearch(status, targetUri, targetID .. (field or ''), mode)
+ else
+ searchID(targetID or forwardID, field)
+ end
end
end
@@ -358,7 +363,12 @@ function m.searchRefsByID(status, uri, expect, mode)
return
end
for _, backwardID in ipairs(node.backward) do
- searchID(backwardID, field)
+ local targetUri, targetID = noder.getUriAndID(backwardID)
+ if targetUri and not files.eq(targetUri, uri) then
+ crossSearch(status, targetUri, targetID .. (field or ''), mode)
+ else
+ searchID(targetID or backwardID, field)
+ end
end
end
@@ -471,9 +481,6 @@ function m.searchRefsByID(status, uri, expect, mode)
if stepCount > 1000 then
error('too large')
end
- if checkCrossUri(id, field) then
- return
- end
local node = noder.getNodeByID(root, id)
if node then
searchNode(id, node, field)