-
-
Notifications
You must be signed in to change notification settings - Fork 384
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
Windows
What is the issue affecting?
Annotations
Expected Behaviour
This type alias should parse as { [1]: string } | number
.
---@alias Some
---| { [1]: string }
---| number
local x ---@type Some
print(x)
Actual Behaviour
The type alias can't be parsed and is left as a free Some
type.
Reproduction steps
- Open a file
- Write the following text
---@alias Some
---| { [1]: string }
---| number
local x ---@type Some
print(x)
- Find that
Some
can't be parsed and is left as a free type, shown whenx
is hovered over
Additional Notes
Following the LSP's expected X
hovers, it completes itself to an alias like { [1|number]: "type name" }
.
---@alias Some
---| { [1]: string }
---| number]: "type name" }
local x ---@type Some
print(x)
It looks like everything after { [1
is ignored and the rest of the line is treated as a comment.
This can be circumvented by putting all the types on one line.
---@alias Some { [1]: string } | number
Log File
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working