summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-08-10 20:19:27 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-08-10 20:19:27 +0800
commitebf15e83ec1d225c392b5c818824339f6cb68a76 (patch)
treed2f329d185fce7d64fb7fe90c14415fd6f5c695b /script
parent24543ab578b67bea57cf9f8c4817665a03515858 (diff)
downloadlua-language-server-ebf15e83ec1d225c392b5c818824339f6cb68a76.zip
improve
Diffstat (limited to 'script')
-rw-r--r--script/core/noder.lua15
-rw-r--r--script/core/searcher.lua25
2 files changed, 29 insertions, 11 deletions
diff --git a/script/core/noder.lua b/script/core/noder.lua
index 102245d9..c2f2061a 100644
--- a/script/core/noder.lua
+++ b/script/core/noder.lua
@@ -1606,14 +1606,13 @@ function m.compileGlobalNodes(root)
m.compilePartNodes(noders, env)
local docs = root.docs
- for i = 1, #docs do
- local doc = docs[i]
- if doc.type == 'doc.class' then
- m.compileNode(noders, doc.class)
- elseif doc.type == 'doc.alias' then
- m.compileNode(noders, doc.alias)
- end
- end
+ guide.eachSourceTypes(docs, {
+ 'doc.class.name',
+ 'doc.alias.name',
+ 'doc.type.name',
+ }, function (doc)
+ m.compileNode(noders, doc)
+ end)
end
files.watch(function (ev, uri)
diff --git a/script/core/searcher.lua b/script/core/searcher.lua
index 0e8ce04c..89bb35d3 100644
--- a/script/core/searcher.lua
+++ b/script/core/searcher.lua
@@ -759,7 +759,7 @@ function m.searchRefsByID(status, suri, expect, mode)
if ssub(id, 1, 2) ~= 'g:' then
return
end
- footprint(status, 'checkGlobal:', id, field)
+ footprint(status, 'searchGlobal:', id, field)
local crossed = {}
if mode == 'def'
or mode == 'alldef'
@@ -792,9 +792,28 @@ function m.searchRefsByID(status, suri, expect, mode)
if ssub(id, 1, 3) ~= 'dn:' then
return
end
- for _, guri in ceach('def:' .. id) do
- if uri ~= guri then
+ footprint(status, 'searchClass:', id, field)
+ local crossed = {}
+ if mode == 'def'
+ or mode == 'alldef'
+ or ignoredIDs[id] then
+ for _, guri in ceach('def:' .. id) do
+ if uri == guri then
+ goto CONTINUE
+ end
searchID(guri, id, field, uri)
+ ::CONTINUE::
+ end
+ else
+ for _, guri in ceach(id) do
+ if crossed[guri] then
+ goto CONTINUE
+ end
+ if uri == guri then
+ goto CONTINUE
+ end
+ searchID(guri, id, field, uri)
+ ::CONTINUE::
end
end
end