summaryrefslogtreecommitdiff
path: root/script/core/searcher.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-06-17 19:34:37 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-06-17 19:34:37 +0800
commit9978771a0f377c6f7663324e96e40f985fb99eb4 (patch)
tree11d3096fdea4d6f8ca7e9458198c859adaf72618 /script/core/searcher.lua
parent2862d7cd292927b608523f5b8ede49c227e7065c (diff)
downloadlua-language-server-9978771a0f377c6f7663324e96e40f985fb99eb4.zip
improve
Diffstat (limited to 'script/core/searcher.lua')
-rw-r--r--script/core/searcher.lua19
1 files changed, 12 insertions, 7 deletions
diff --git a/script/core/searcher.lua b/script/core/searcher.lua
index 5a417765..b7c86262 100644
--- a/script/core/searcher.lua
+++ b/script/core/searcher.lua
@@ -477,21 +477,26 @@ function m.searchRefsByID(status, uri, expect, mode)
if FOOTPRINT then
status.footprint[#status.footprint+1] = ('checkGlobal:%s + %s, isCall: %s'):format(id, field, isCall, tid)
end
- for guri, def in collector.each(id) do
- if def then
- crossSearch(status, guri, tid, mode, uri)
+ local crossed = {}
+ for _, guri in collector.each('def:' .. id) do
+ if files.eq(uri, guri) then
goto CONTINUE
end
- if isCall then
+ crossed[guri] = true
+ crossSearch(status, guri, tid, mode, uri)
+ ::CONTINUE::
+ end
+ for _, guri in collector.each(id) do
+ if crossed[guri] then
goto CONTINUE
end
- if not field then
+ if isCall then
goto CONTINUE
end
- if mode == 'def' then
+ if not field and mode == 'def' then
goto CONTINUE
end
- if not files.eq(uri, guri) then
+ if files.eq(uri, guri) then
goto CONTINUE
end
crossSearch(status, guri, tid, mode, uri)