summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.md1
-rw-r--r--script/vm/def.lua6
-rw-r--r--test/crossfile/definition.lua2
-rw-r--r--test/definition/luadoc.lua2
-rw-r--r--test/highlight/init.lua13
5 files changed, 22 insertions, 2 deletions
diff --git a/changelog.md b/changelog.md
index 0217072c..8508c366 100644
--- a/changelog.md
+++ b/changelog.md
@@ -190,6 +190,7 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`.
[#1642]: https://github.com/sumneko/lua-language-server/issues/1642
[#1662]: https://github.com/sumneko/lua-language-server/issues/1662
[#1663]: https://github.com/sumneko/lua-language-server/issues/1663
+[#1670]: https://github.com/sumneko/lua-language-server/issues/1670
## 3.5.6
`2022-9-16`
diff --git a/script/vm/def.lua b/script/vm/def.lua
index b1bedc43..9bc6159b 100644
--- a/script/vm/def.lua
+++ b/script/vm/def.lua
@@ -69,6 +69,12 @@ function vm.getDefs(source)
return
end
hasLocal = true
+ if source.type ~= 'local'
+ and source.type ~= 'getlocal'
+ and source.type ~= 'setlocal'
+ and source.type ~= 'doc.cast.name' then
+ return
+ end
end
if not mark[src] then
mark[src] = true
diff --git a/test/crossfile/definition.lua b/test/crossfile/definition.lua
index ef9b5240..e924c43f 100644
--- a/test/crossfile/definition.lua
+++ b/test/crossfile/definition.lua
@@ -435,7 +435,7 @@ TEST {
{
path = 'a.lua',
content = [[
- local <!x!>
+ local x
return {
<!x!> = x,
}
diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua
index d8b3ef60..a2605bcb 100644
--- a/test/definition/luadoc.lua
+++ b/test/definition/luadoc.lua
@@ -935,7 +935,7 @@ local a
a.__index = a
---@class B: A
-local <!b!>
+local b
b.<!<?__index?>!> = b
]]
diff --git a/test/highlight/init.lua b/test/highlight/init.lua
index 1bd6cf35..4baea6f6 100644
--- a/test/highlight/init.lua
+++ b/test/highlight/init.lua
@@ -141,3 +141,16 @@ TEST [[
<!TEST1!> = 1
TEST2 = 2
]]
+
+TEST [[
+local zing = foo
+local foo = 4
+
+local bar = {
+ <!baz!> = foo
+}
+
+bar.<!baz!> = 5
+
+print(bar.<!baz!>)
+]]