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/core/searcher.lua | |
parent | 04eaf63f02b1ac74bdf5c8dfedfbe7ad613427fb (diff) | |
download | lua-language-server-eae8ad580971c7a12c1324476fa0335551445cef.zip |
optimization
Diffstat (limited to 'script/core/searcher.lua')
-rw-r--r-- | script/core/searcher.lua | 16 |
1 files changed, 13 insertions, 3 deletions
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) |