From ac0e8323dc82622a201f49efcdfcb79567a8f75e Mon Sep 17 00:00:00 2001 From: Maria José Solano Date: Wed, 21 Feb 2024 03:31:56 -0800 Subject: fix(lsp): add parentheses to generated union array types (#27560) --- scripts/gen_lsp.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/gen_lsp.lua b/scripts/gen_lsp.lua index b332a17fdc..19fad7bab4 100644 --- a/scripts/gen_lsp.lua +++ b/scripts/gen_lsp.lua @@ -224,7 +224,11 @@ function M.gen(opt) -- ArrayType elseif type.kind == 'array' then - return parse_type(type.element, prefix) .. '[]' + local parsed_items = parse_type(type.element, prefix) + if type.element.items and #type.element.items > 1 then + parsed_items = '(' .. parsed_items .. ')' + end + return parsed_items .. '[]' -- OrType elseif type.kind == 'or' then -- cgit