From 789cb1598a53c615164a5df7a1c4056f7d4130eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 30 Dec 2021 15:23:56 +0800 Subject: fix --- script/core/searcher.lua | 12 ++++++------ test/completion/init.lua | 2 +- test/crossfile/completion.lua | 1 - 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/script/core/searcher.lua b/script/core/searcher.lua index 8e4873aa..68852062 100644 --- a/script/core/searcher.lua +++ b/script/core/searcher.lua @@ -820,7 +820,7 @@ function m.searchRefsByID(status, suri, expect, mode) or mode == 'alldef' or field or hasCall(field) then - for _, guri in ceach(uri, 'def:' .. id) do + for _, guri in ceach(suri, 'def:' .. id) do if uri == guri then goto CONTINUE end @@ -829,14 +829,14 @@ function m.searchRefsByID(status, suri, expect, mode) end elseif mode == 'field' or mode == 'allfield' then - for _, guri in ceach(uri, 'def:' .. id) do + for _, guri in ceach(suri, 'def:' .. id) do if uri == guri then goto CONTINUE end searchID(guri, id, field, uri) ::CONTINUE:: end - for _, guri in ceach(uri, 'field:' .. id) do + for _, guri in ceach(suri, 'field:' .. id) do if uri == guri then goto CONTINUE end @@ -844,7 +844,7 @@ function m.searchRefsByID(status, suri, expect, mode) ::CONTINUE:: end else - for _, guri in ceach(uri, id) do + for _, guri in ceach(suri, id) do if crossed[guri] then goto CONTINUE end @@ -872,7 +872,7 @@ function m.searchRefsByID(status, suri, expect, mode) or ignoredIDs[id] or id == 'dn:string' or hasCall(field) then - for _, guri in ceach(uri, 'def:' .. id) do + for _, guri in ceach(suri, 'def:' .. id) do if uri == guri then goto CONTINUE end @@ -880,7 +880,7 @@ function m.searchRefsByID(status, suri, expect, mode) ::CONTINUE:: end else - for _, guri in ceach(uri, id) do + for _, guri in ceach(suri, id) do if crossed[guri] then goto CONTINUE end diff --git a/test/completion/init.lua b/test/completion/init.lua index 1c485f63..89325883 100644 --- a/test/completion/init.lua +++ b/test/completion/init.lua @@ -76,7 +76,6 @@ function TEST(script) local triggerCharacter = script:sub(inputPos, inputPos) local result = core.completion('', inputPos, triggerCharacter) - files.remove('') if not expect then assert(result == nil) return @@ -116,6 +115,7 @@ function TEST(script) else assert(eq(expect, result)) end + files.remove('') end end diff --git a/test/crossfile/completion.lua b/test/crossfile/completion.lua index d286a24d..9926e342 100644 --- a/test/crossfile/completion.lua +++ b/test/crossfile/completion.lua @@ -103,7 +103,6 @@ function TEST(data) end local expect = data.completion - core.clearCache() local result = core.completion(mainUri, pos, '') if not expect then assert(result == nil) -- cgit v1.2.3