From acd37caafa2b4e9fa673327e54c5f010fa37641f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 9 Aug 2021 17:47:56 +0800 Subject: `FIX` completion: can not find global fields --- .vscode/launch.json | 2 +- changelog.md | 3 +++ script/core/searcher.lua | 4 ---- test/crossfile/completion.lua | 17 +++++++++++++++++ 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 513489bc..2655115d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -24,7 +24,7 @@ "type": "lua", "request": "attach", "stopOnEntry": true, - "address": "127.0.0.1:11427", + "address": "127.0.0.1:11556", "outputCapture": [ ], "sourceMaps": [ diff --git a/changelog.md b/changelog.md index a2c8f5b1..e1f64cd5 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # changelog +## 2.3.6 +* `FIX` completion: can not find global fields + ## 2.3.5 `2021-8-9` * `CHG` improve memory usage diff --git a/script/core/searcher.lua b/script/core/searcher.lua index 9acc4e8e..0e8ce04c 100644 --- a/script/core/searcher.lua +++ b/script/core/searcher.lua @@ -763,7 +763,6 @@ function m.searchRefsByID(status, suri, expect, mode) local crossed = {} if mode == 'def' or mode == 'alldef' - or mode == 'field' or field then for _, guri in ceach('def:' .. id) do if uri == guri then @@ -777,9 +776,6 @@ function m.searchRefsByID(status, suri, expect, mode) if crossed[guri] then goto CONTINUE end - if mode == 'def' or mode == 'alldef' or mode == 'field' then - goto CONTINUE - end if uri == guri then goto CONTINUE end diff --git a/test/crossfile/completion.lua b/test/crossfile/completion.lua index 3abc1de4..84d31544 100644 --- a/test/crossfile/completion.lua +++ b/test/crossfile/completion.lua @@ -767,3 +767,20 @@ function (a: any, b: any) Cared['detail'] = nil Cared['additionalTextEdits'] = nil end + +TEST { + { + path = 'a.lua', + content = [[ + A.B = 1 + ]] + }, + { + path = 'main.lua', + main = true, + content = [[ + A.$ + ]], + }, + completion = EXISTS, +} -- cgit v1.2.3