1
This commit is contained in:
Alex Yatskov 2023-02-20 14:21:29 -08:00
parent 6fe2301c89
commit 7c84e7a940

View File

@ -8,6 +8,9 @@ local argonaut_configs = {
wrap_closing_brace = true,
comma_first = false,
comma_first_indent = false,
},
go = {
tail_comma = true,
}
}
@ -247,24 +250,32 @@ local function parse_brace_range(brace_range)
end
local function wrap_brace_range(brace_range)
local config = get_config()
vim.fn.setline(brace_range.row1, brace_range.indent .. brace_range.prefix)
local row = brace_range.row1
for i, param in ipairs(brace_range.params) do
local last = i == #brace_range.params
local on_last_row = i == #brace_range.params
local line = brace_range.indent .. param
if not last then
if config.tail_comma or not on_last_row then
line = line .. ','
end
if on_last_row and not config.wrap_closing_brace then
line = line .. brace_range.suffix
end
vim.fn.append(row, line)
vim.fn.execute(string.format('%d>', row + 1))
row = row + 1
end
if config.wrap_closing_brace then
vim.fn.append(row, brace_range.indent .. brace_range.suffix)
end
end
local function unwrap_brace_range(brace_range)