lua-language-server icon indicating copy to clipboard operation
lua-language-server copied to clipboard

Unable to use `@enum` or `@alias` type in table index (index signature)

Open tmillr opened this issue 1 year ago • 4 comments

I don't know if this is intended or not, but IIRC this is possible in typescript.

---@enum idx
local enum = { a = 'a', b = 'b' }

---@param tbl table<idx, string>
local function x(tbl) end

When calling x with a table (e.g. x({ | })), I expect to receive completion for a and b, but I don't get that.

tmillr avatar Aug 11 '24 12:08 tmillr

Surprisingly, it doesn't work with @alias either -_-.

I guess @alias doesn't actually create an "alias".

tmillr avatar Aug 11 '24 13:08 tmillr

Some similar issues:

  • #2410
  • #2610
  • #2783

tomlau10 avatar Aug 12 '24 01:08 tomlau10

This used to work perfectly fine, what broke it? I remember using this december last year with no issue at all. Is it the LSP or VS Code?

wiredmatt avatar Oct 05 '24 01:10 wiredmatt

Is it the LSP or VS Code?

LSP. I don't use vscode.

tmillr avatar Oct 05 '24 15:10 tmillr