diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-11-16 20:50:46 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-11-18 17:11:07 +0800 |
commit | eae8ad580971c7a12c1324476fa0335551445cef (patch) | |
tree | d6eb7b69c7e90ade69ea1ddbce7fc16a20c397d6 /script | |
parent | 04eaf63f02b1ac74bdf5c8dfedfbe7ad613427fb (diff) | |
download | lua-language-server-eae8ad580971c7a12c1324476fa0335551445cef.zip |
optimization
Diffstat (limited to 'script')
-rw-r--r-- | script/core/noder.lua | 6 | ||||
-rw-r--r-- | script/core/searcher.lua | 16 |
2 files changed, 19 insertions, 3 deletions
diff --git a/script/core/noder.lua b/script/core/noder.lua index 79cff366..b9d28fca 100644 --- a/script/core/noder.lua +++ b/script/core/noder.lua @@ -1484,6 +1484,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) |