summaryrefslogtreecommitdiff
path: root/script/core/searcher.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-05-31 20:45:13 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-05-31 20:45:13 +0800
commitfea133554b47ac6aef9a55d53e3f694311b10fcd (patch)
treef6a8e975cfb530de4dfe328e24b1df2a7d0eca3d /script/core/searcher.lua
parentfea027821633ef07c5f702a9fe7eb65952f5a4b2 (diff)
downloadlua-language-server-fea133554b47ac6aef9a55d53e3f694311b10fcd.zip
stash
Diffstat (limited to 'script/core/searcher.lua')
-rw-r--r--script/core/searcher.lua16
1 files changed, 14 insertions, 2 deletions
diff --git a/script/core/searcher.lua b/script/core/searcher.lua
index 4063426d..9208032c 100644
--- a/script/core/searcher.lua
+++ b/script/core/searcher.lua
@@ -24,7 +24,7 @@ local ignoredIDs = {
local m = {}
----@alias guide.searchmode '"ref"'|'"def"'|'"field"'
+---@alias guide.searchmode '"ref"'|'"def"'
---添加结果
---@param status guide.status
@@ -227,7 +227,7 @@ function m.searchRefsByID(status, uri, expect, mode)
mark[id] = cmark
end
log.debug('search:', id, field)
- if field then
+ if field then
if cmark[field] then
return
end
@@ -456,12 +456,24 @@ function m.searchRefsByID(status, uri, expect, mode)
end
end
+ local function checkCrossUri(id, field)
+ local targetUri, newID = noder.getUriAndID(id)
+ if not targetUri then
+ return false
+ end
+ crossSearch(status, targetUri, newID .. (field or ''), mode)
+ return true
+ end
+
local stepCount = 0
function searchStep(id, field)
stepCount = stepCount + 1
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)