Wrapping
This commit is contained in:
parent
6fe2301c89
commit
7c84e7a940
@ -8,6 +8,9 @@ local argonaut_configs = {
|
|||||||
wrap_closing_brace = true,
|
wrap_closing_brace = true,
|
||||||
comma_first = false,
|
comma_first = false,
|
||||||
comma_first_indent = false,
|
comma_first_indent = false,
|
||||||
|
},
|
||||||
|
go = {
|
||||||
|
tail_comma = true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,24 +250,32 @@ local function parse_brace_range(brace_range)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function wrap_brace_range(brace_range)
|
local function wrap_brace_range(brace_range)
|
||||||
|
local config = get_config()
|
||||||
|
|
||||||
vim.fn.setline(brace_range.row1, brace_range.indent .. brace_range.prefix)
|
vim.fn.setline(brace_range.row1, brace_range.indent .. brace_range.prefix)
|
||||||
|
|
||||||
local row = brace_range.row1
|
local row = brace_range.row1
|
||||||
for i, param in ipairs(brace_range.params) do
|
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
|
local line = brace_range.indent .. param
|
||||||
if not last then
|
if config.tail_comma or not on_last_row then
|
||||||
line = line .. ','
|
line = line .. ','
|
||||||
end
|
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.append(row, line)
|
||||||
vim.fn.execute(string.format('%d>', row + 1))
|
vim.fn.execute(string.format('%d>', row + 1))
|
||||||
|
|
||||||
row = row + 1
|
row = row + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if config.wrap_closing_brace then
|
||||||
vim.fn.append(row, brace_range.indent .. brace_range.suffix)
|
vim.fn.append(row, brace_range.indent .. brace_range.suffix)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function unwrap_brace_range(brace_range)
|
local function unwrap_brace_range(brace_range)
|
||||||
|
Loading…
Reference in New Issue
Block a user