diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-06-28 21:06:32 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-06-28 21:06:32 +0800 |
commit | 8f866ad07b550b49c2d102fe62a6a3b8b267685b (patch) | |
tree | 471f602900a17cf82b07dd9bc883f7b86b50324f /script | |
parent | 36ae602074c2324cff46cadb3c742526708a9a72 (diff) | |
download | lua-language-server-8f866ad07b550b49c2d102fe62a6a3b8b267685b.zip |
stash
Diffstat (limited to 'script')
-rw-r--r-- | script/core/searcher.lua | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/script/core/searcher.lua b/script/core/searcher.lua index f7e8da06..ad59c53c 100644 --- a/script/core/searcher.lua +++ b/script/core/searcher.lua @@ -453,7 +453,12 @@ function m.searchRefsByID(status, uri, expect, mode) popTags[tag] = popTags[tag] - 1 end + local expanding = {} local function checkForward(id, node, field) + if expanding[id] then + return + end + expanding[id] = true for forwardID, tag in noder.eachForward(node) do if not checkThenPushTag('forward', tag) then goto CONTINUE @@ -467,13 +472,18 @@ function m.searchRefsByID(status, uri, expect, mode) popTag('forward', tag) ::CONTINUE:: end + expanding[id] = nil end local function checkBackward(id, node, field) - if mode ~= 'ref' and mode ~= 'field' and mode ~= 'allref' and not field then + if ignoredIDs[id] then return end - if ignoredIDs[id] then + if expanding[id] then + return + end + expanding[id] = true + if mode ~= 'ref' and mode ~= 'field' and mode ~= 'allref' and not field then return end for backwardID, tag in noder.eachBackward(node) do @@ -492,6 +502,7 @@ function m.searchRefsByID(status, uri, expect, mode) popTag('backward', tag) ::CONTINUE:: end + expanding[id] = nil end local function checkSpecial(id, field) |