Skip to content

Automatically filling in a table which is defined as a @class #2897

Answered by tomlau10
fgimian asked this question in Q&A
Discussion options

You must be logged in to vote

I believe luals has no such features (both 1 & 2) currently.

And specifically displaying fields in the order they are defined may not fit how luals actually works 🤔 . In luals, a @class annotation can be defined multiple times in multiple files, that's for defining corresponding fields in different sub files of a large class. For example:

  • test/a.lua
---@class Test
---@field a string
  • test/b.lua
---@class Test
---@field b integer
  • then luals will merge these field into the same Test class =>
Test = {
  a: string
  b: integer
}

Since a @class is allowed to be defined multiple times, and more importantly in different files, I believe there is no defined order concept for it 😕

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@fgimian
Comment options

Answer selected by fgimian
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants