aboutsummaryrefslogtreecommitdiff
path: root/scripts/gen_lsp.lua
diff options
context:
space:
mode:
authorMaria José Solano <majosolano99@gmail.com>2024-02-21 03:31:56 -0800
committerGitHub <noreply@github.com>2024-02-21 12:31:56 +0100
commitac0e8323dc82622a201f49efcdfcb79567a8f75e (patch)
tree74578b89daf09d694ad1b34a17cff66bc8dc41dc /scripts/gen_lsp.lua
parent09651342e746af38c38f22f3cae6bfb40dade327 (diff)
downloadrneovim-ac0e8323dc82622a201f49efcdfcb79567a8f75e.tar.gz
rneovim-ac0e8323dc82622a201f49efcdfcb79567a8f75e.tar.bz2
rneovim-ac0e8323dc82622a201f49efcdfcb79567a8f75e.zip
fix(lsp): add parentheses to generated union array types (#27560)
Diffstat (limited to 'scripts/gen_lsp.lua')
-rw-r--r--scripts/gen_lsp.lua6
1 files changed, 5 insertions, 1 deletions
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