Skip to content

Commit 0295ad8

Browse files
authored
Merge pull request #1962 from jharajeev55/issue/1940
Array of a class type does not get completion #1940
2 parents 677fac0 + e5a99c3 commit 0295ad8

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

script/vm/compiler.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,10 +1908,9 @@ function vm.compileNode(source)
19081908

19091909
---@cast source parser.object
19101910
vm.setNode(source, vm.createNode(), true)
1911-
if not vm.compileByGlobal(source) then
1912-
vm.compileByVariable(source)
1913-
compileByNode(source)
1914-
end
1911+
vm.compileByGlobal(source)
1912+
vm.compileByVariable(source)
1913+
compileByNode(source)
19151914
compileByParentNode(source)
19161915
matchCall(source)
19171916

test/crossfile/completion.lua

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,37 @@ local function WITH_CONFIG(cfg, f)
124124
end
125125
end
126126

127+
TEST {
128+
{
129+
path = 'abc.lua',
130+
content = [[
131+
---@meta
132+
133+
---@class A
134+
---@field f1 integer
135+
---@field f2 boolean
136+
137+
---@type A[]
138+
X = {}
139+
]],
140+
},
141+
{
142+
path = 'test.lua',
143+
content = [[ X[1].<??>]],
144+
main = true,
145+
},
146+
completion = {
147+
{
148+
label = 'f1',
149+
kind = CompletionItemKind.Field,
150+
},
151+
{
152+
label = 'f2',
153+
kind = CompletionItemKind.Field,
154+
},
155+
}
156+
}
157+
127158
TEST {
128159
{
129160
path = 'abc.lua',

0 commit comments

Comments
 (0)