LuaLS / lua-language-server

A language server that offers Lua language support - programmed in Lua
https://luals.github.io
MIT License
3.35k stars 320 forks source link

Request to allow mutiline `@type` values #2200

Open wauterboi opened 1 year ago

wauterboi commented 1 year ago

Sometimes, a @type value can be very long, i.e.

---@type {filepath: string?, type: 'unknown'|'binary'|'stock'|'path', loader: function}

Of course, while I could clean-up the above by replacing type with its own alias, I still think it would be nice to be able to do this:

---@type {
---  filepath: string?,
---  type: 'unknown'|'binary'|'stock'|'path',
---  loader: function
---}
firas-assaad commented 1 year ago

Alternatively (or in addition), it'd be nice if we had file-scoped class definitions so you could use the existing @class syntax without creating a new definition for the entire project. It's the main reason I prefer ---@type { ... } most of the time.

Edit: or namespaces like in #1167

corporalik commented 4 months ago

just was trying to write a multiline @alias in same manner, but unfortunately :)

---@alias Alias {
---[1]:string
---[2]:number
---[3]:boolean
...
---[25]:string
---}