summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-11-16 20:50:46 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-11-16 20:50:46 +0800
commite79c7c3b4e6ed66d4f43936510a29617485f5818 (patch)
tree955c42536e04c2c554a39bb7210d63ebd1be20c3 /script
parenta89fd50f6267822e8e08063633077fbf7a669e12 (diff)
downloadlua-language-server-e79c7c3b4e6ed66d4f43936510a29617485f5818.zip
optimization
Diffstat (limited to 'script')
-rw-r--r--script/core/noder.lua6
-rw-r--r--script/core/searcher.lua16
2 files changed, 19 insertions, 3 deletions
diff --git a/script/core/noder.lua b/script/core/noder.lua
index 04066160..ee5c4975 100644
--- a/script/core/noder.lua
+++ b/script/core/noder.lua
@@ -1444,6 +1444,12 @@ function m.compileNode(noders, source)
local defID = 'def:' .. id
collector.subscribe(uri, defID, noders)
+ local fieldID = m.getLastID(id)
+ if fieldID then
+ local defNodeID = 'field:' .. fieldID
+ collector.subscribe(uri, defNodeID, noders)
+ end
+
if guide.isGlobal(source) then
local defAnyID = 'def:g:'
collector.subscribe(uri, defAnyID, noders)
diff --git a/script/core/searcher.lua b/script/core/searcher.lua
index f2b9b291..4ce89fd1 100644
--- a/script/core/searcher.lua
+++ b/script/core/searcher.lua
@@ -775,7 +775,8 @@ function m.searchRefsByID(status, suri, expect, mode)
local crossed = {}
if mode == 'def'
or mode == 'alldef'
- or field then
+ or field
+ or hasCall(field) then
for _, guri in ceach('def:' .. id) do
if uri == guri then
goto CONTINUE
@@ -783,6 +784,15 @@ function m.searchRefsByID(status, suri, expect, mode)
searchID(guri, id, field, uri)
::CONTINUE::
end
+ elseif mode == 'field'
+ or mode == 'allfield' then
+ for _, guri in ceach('field:' .. 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
@@ -929,9 +939,9 @@ function m.searchRefsByID(status, suri, expect, mode)
end
local stepCount = 0
- local stepMaxCount = 1e4
+ local stepMaxCount = 1e3
if mode == 'allref' or mode == 'alldef' then
- stepMaxCount = 1e5
+ stepMaxCount = 1e4
end
function searchStep(uri, id, field)