-
-
Notifications
You must be signed in to change notification settings - Fork 374
Closed
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
I want to create a generic class with a private field, but this is not supported.
---@class Array<T>: { [integer]: T }
---@field private length integer
length
field refers to an Array class, not an Array<T>, well the signs
(generic class) are not good at this moment.
But I can do table/turple declaration
---@class Array<T>: { [integer]: T, length: integer }
unfortunately I can't specify the scope result.visible
(private, protected, public, package).
Actual Behaviour
It's easy to add this for parsing in luadoc, what about this syntax?
---@class Array<T>: { [integer]: T, (private) length: integer } -- OK
---@class Array<T>: { [integer]: T, private length: integer } -- OK
---@class Array<T>: { [integer]: T, (private length: integer) } -- OK
---@class Array<T>: { [integer]: T, ((private) length: integer) } -- wrong?
or
---@class Array<T>: { [integer]: T, (private) length: integer } -- OK
---@class Array<T>: { [integer]: T, private length: integer } -- wrong
---@class Array<T>: { [integer]: T, (private length: integer) } -- wrong
---@class Array<T>: { [integer]: T, ((private) length: integer) } -- OK
References:
parseTable
lua-language-server/script/parser/luadoc.lua
Lines 351 to 356 in 8a6d9db
if checkToken('symbol', '(', 1) then | |
nextToken() | |
needCloseParen = true | |
end | |
field.name = parseName('doc.field.name', field) | |
or parseIndexField(field) |
result.visible
lua-language-server/script/parser/luadoc.lua
Lines 1169 to 1187 in 8a6d9db
try(function () | |
local tp, value = nextToken() | |
if tp == 'name' then | |
if value == 'public' | |
or value == 'protected' | |
or value == 'private' | |
or value == 'package' then | |
local tp2 = peekToken(1) | |
local tp3 = peekToken(2) | |
if tp2 == 'name' and not tp3 then | |
return false | |
end | |
result.visible = value | |
result.start = getStart() | |
return true | |
end | |
end | |
return false | |
end) |
I want to hear someone's opinion.
Metadata
Metadata
Assignees
Labels
No labels