add classes for each parser.object type#2870
Conversation
wow~ this is great idea and great work 👍 If this can be completed, then the auto completion for each object type will be much more accurate.
I just checked out this PR and did a full workspace diagnostics, currently there are
|
I think I know why... the narrow types based on literal fields feature is doing more works than someone would have expected 😇 lua-language-server/script/vm/tracer.lua Lines 232 to 252 in 6ba0c93
---@class parser.object.other : parser.object.base
---...
---@field mode? '+' | '-'
|
That looks like a bug. The narrow shouldn't narrow |
Looks like you are right. The 4.0 branch already has separated AST classes: 54d6c28#diff-23e30c69ec9b9d4cbd4b4820a36c729e86f8621179a102abc1a30cad16334dcf EDIT: fixed in #2871 |
|
Ok won't bother with this and will wait for 4.0. I'll focus my contributions to things that add tests, since those can be ported forward. |
Now LuaLS can narrow types based on literal fields (see #2864), I've began to break out
parser.objectinto smaller classes that contain the exact fields for each.This results in a lot of type warnings for
script/vm/*that may be difficult to resolve.Is this something that is worth pursuing or would it be preferred to maintain
parser.objectare a large class with lots of optional fields?