Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array of a class type does not get completion #1940 #1962

Merged
merged 1 commit into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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