Skip to content

Commit

Permalink
Merge pull request #1962 from jharajeev55/issue/1940
Browse files Browse the repository at this point in the history
Array of a class type does not get completion #1940
  • Loading branch information
sumneko authored Mar 2, 2023
2 parents 677fac0 + e5a99c3 commit 0295ad8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
7 changes: 3 additions & 4 deletions script/vm/compiler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1908,10 +1908,9 @@ function vm.compileNode(source)

---@cast source parser.object
vm.setNode(source, vm.createNode(), true)
if not vm.compileByGlobal(source) then
vm.compileByVariable(source)
compileByNode(source)
end
vm.compileByGlobal(source)
vm.compileByVariable(source)
compileByNode(source)
compileByParentNode(source)
matchCall(source)

Expand Down
31 changes: 31 additions & 0 deletions test/crossfile/completion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,37 @@ local function WITH_CONFIG(cfg, f)
end
end

TEST {
{
path = 'abc.lua',
content = [[
---@meta
---@class A
---@field f1 integer
---@field f2 boolean
---@type A[]
X = {}
]],
},
{
path = 'test.lua',
content = [[ X[1].<??>]],
main = true,
},
completion = {
{
label = 'f1',
kind = CompletionItemKind.Field,
},
{
label = 'f2',
kind = CompletionItemKind.Field,
},
}
}

TEST {
{
path = 'abc.lua',
Expand Down

0 comments on commit 0295ad8

Please sign in to comment.