diff options
-rw-r--r-- | runtime/doc/help.txt | 1 | ||||
-rw-r--r-- | runtime/lua/vim/lsp/_meta/protocol.lua | 2 | ||||
-rw-r--r-- | scripts/gen_lsp.lua | 8 | ||||
-rw-r--r-- | scripts/luacats_grammar.lua | 3 | ||||
-rw-r--r-- | test/functional/script/luacats_grammar_spec.lua | 7 |
5 files changed, 15 insertions, 6 deletions
diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt index 43f80101ed..685bce2553 100644 --- a/runtime/doc/help.txt +++ b/runtime/doc/help.txt @@ -127,6 +127,7 @@ PROGRAMMING LANGUAGE SUPPORT |filetype| Settings for specific types of files |quickfix| Commands for a quick edit-compile-fix cycle |ft_ada.txt| Ada filetype plugin +|ft_hare.txt| Filetype plugin for Hare |ft_ps1.txt| PowerShell filetype plugin |ft_raku.txt| Raku filetype plugin |ft_rust.txt| Rust filetype plugin diff --git a/runtime/lua/vim/lsp/_meta/protocol.lua b/runtime/lua/vim/lsp/_meta/protocol.lua index 9a11972007..cbddd24630 100644 --- a/runtime/lua/vim/lsp/_meta/protocol.lua +++ b/runtime/lua/vim/lsp/_meta/protocol.lua @@ -3235,7 +3235,7 @@ error('Cannot require a meta file') --- ---*Note*: a label of type string should be a substring of its containing signature label. ---Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`. ----@field label string|{ [1]: uinteger, [2]: uinteger } +---@field label string|[uinteger, uinteger] --- ---The human-readable doc-comment of this parameter. Will be shown ---in the UI but can be omitted. diff --git a/scripts/gen_lsp.lua b/scripts/gen_lsp.lua index 04d19f22e6..1706b39864 100644 --- a/scripts/gen_lsp.lua +++ b/scripts/gen_lsp.lua @@ -297,13 +297,13 @@ function M.gen(opt) -- TupleType elseif type.kind == 'tuple' then - local tuple = '{ ' - for i, value in ipairs(type.items) do - tuple = tuple .. '[' .. i .. ']: ' .. parse_type(value, prefix) .. ', ' + local tuple = '[' + for _, value in ipairs(type.items) do + tuple = tuple .. parse_type(value, prefix) .. ', ' end -- remove , at the end tuple = tuple:sub(0, -3) - return tuple .. ' }' + return tuple .. ']' end vim.print('WARNING: Unknown type ', type) diff --git a/scripts/luacats_grammar.lua b/scripts/luacats_grammar.lua index 29f3bda5aa..6742eab5e9 100644 --- a/scripts/luacats_grammar.lua +++ b/scripts/luacats_grammar.lua @@ -170,7 +170,7 @@ local grammar = P { ltype = parenOpt(v.ty_union), ty_union = v.ty_opt * rep(Pf('|') * v.ty_opt), - ty = v.ty_fun + ident + v.ty_table + literal + paren(v.ty) + v.ty_generic, + ty = v.ty_fun + ident + v.ty_table + literal + paren(v.ty) + v.ty_generic + v.ty_tuple, ty_param = Pf('<') * comma1(v.ltype) * fill * P('>'), ty_opt = v.ty * opt(v.ty_param) * opt(P('[]')) * opt(P('?')), ty_index = (Pf('[') * (v.ltype + ident + rep1(num)) * fill * P(']')), @@ -180,6 +180,7 @@ local grammar = P { fun_param = lname * opt(colon * v.ltype), ty_fun = Pf('fun') * paren(comma(lname * opt(colon * v.ltype))) * opt(colon * comma1(v.ltype)), ty_generic = P('`') * letter * P('`'), + ty_tuple = Pf('[') * comma(v.ty_opt) * fill * P(']'), } return grammar --[[@as nvim.luacats.grammar]] diff --git a/test/functional/script/luacats_grammar_spec.lua b/test/functional/script/luacats_grammar_spec.lua index 6d444e1888..d6fff3f409 100644 --- a/test/functional/script/luacats_grammar_spec.lua +++ b/test/functional/script/luacats_grammar_spec.lua @@ -159,4 +159,11 @@ describe('luacats grammar', function() name = 'type', type = '`T`', }) + + test('@param type [number,string] this is a tuple type', { + desc = 'this is a tuple type', + kind = 'param', + name = 'type', + type = '[number,string]', + }) end) |