Skip to content

Commit 6176475

Browse files
committed
don't find other locals
fix #1670
1 parent b1e0cdb commit 6176475

File tree

5 files changed

+22
-2
lines changed

5 files changed

+22
-2
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`.
190190
[#1642]: https://github.com/sumneko/lua-language-server/issues/1642
191191
[#1662]: https://github.com/sumneko/lua-language-server/issues/1662
192192
[#1663]: https://github.com/sumneko/lua-language-server/issues/1663
193+
[#1670]: https://github.com/sumneko/lua-language-server/issues/1670
193194

194195
## 3.5.6
195196
`2022-9-16`

script/vm/def.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ function vm.getDefs(source)
6969
return
7070
end
7171
hasLocal = true
72+
if source.type ~= 'local'
73+
and source.type ~= 'getlocal'
74+
and source.type ~= 'setlocal'
75+
and source.type ~= 'doc.cast.name' then
76+
return
77+
end
7278
end
7379
if not mark[src] then
7480
mark[src] = true

test/crossfile/definition.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ TEST {
435435
{
436436
path = 'a.lua',
437437
content = [[
438-
local <!x!>
438+
local x
439439
return {
440440
<!x!> = x,
441441
}

test/definition/luadoc.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ local a
935935
a.__index = a
936936
937937
---@class B: A
938-
local <!b!>
938+
local b
939939
b.<!<?__index?>!> = b
940940
]]
941941

test/highlight/init.lua

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,16 @@ TEST [[
141141
<!TEST1!> = 1
142142
TEST2 = 2
143143
]]
144+
145+
TEST [[
146+
local zing = foo
147+
local foo = 4
148+
149+
local bar = {
150+
<!baz!> = foo
151+
}
152+
153+
bar.<!baz!> = 5
154+
155+
print(bar.<!baz!>)
156+
]]

0 commit comments

Comments
 (0)