summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-19 01:07:28 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-19 01:07:28 +0800
commit7657fefe4ab5b6ba7dcb7df7e766c115afa25787 (patch)
treeb15683169147dc7b27884139cf700989e027c128
parente699faf8b1da8235805b13dc4c6d5a39629c70a6 (diff)
downloadlua-language-server-7657fefe4ab5b6ba7dcb7df7e766c115afa25787.zip
fix #3.1.1
-rw-r--r--changelog.md3
-rw-r--r--script/vm/field.lua11
-rw-r--r--test/completion/common.lua13
3 files changed, 27 insertions, 0 deletions
diff --git a/changelog.md b/changelog.md
index 7623409b..983af002 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,8 @@
# changelog
+## 3.1.1
+* `FIX` [#1051](https://github.com/sumneko/lua-language-server/issues/1051)
+
## 3.1.0
`2022-4-17`
* `NEW` support find definition in method
diff --git a/script/vm/field.lua b/script/vm/field.lua
index ba7cd4c1..614dc89b 100644
--- a/script/vm/field.lua
+++ b/script/vm/field.lua
@@ -2,6 +2,7 @@
local vm = require 'vm.vm'
local util = require 'utility'
local guide = require 'parser.guide'
+local localID = require 'vm.local-id'
local searchByNodeSwitch = util.switch()
: case 'global'
@@ -15,6 +16,15 @@ local searchByNodeSwitch = util.switch()
pushResult(source)
end)
+local function searchByLocalID(source, pushResult)
+ local fields = localID.getFields(source)
+ if fields then
+ for _, field in ipairs(fields) do
+ pushResult(field)
+ end
+ end
+end
+
local function searchByNode(source, pushResult)
local uri = guide.getUri(source)
vm.compileByParentNode(source, nil, true, function (field)
@@ -35,6 +45,7 @@ function vm.getFields(source)
end
end
+ searchByLocalID(source, pushResult)
searchByNode(source, pushResult)
return results
diff --git a/test/completion/common.lua b/test/completion/common.lua
index 538ac401..1fc37bb5 100644
--- a/test/completion/common.lua
+++ b/test/completion/common.lua
@@ -3311,3 +3311,16 @@ TEST [[
end
assert(count == 1)
end)
+
+TEST [[
+local x
+x.y.z = xxx
+
+x.y.<??>
+]]
+{
+ {
+ label = 'z',
+ kind = define.CompletionItemKind.Field,
+ }
+}