1
This commit is contained in:
Alex Yatskov 2024-04-24 20:38:40 -07:00
parent 14809767fc
commit b20e48c972

View File

@ -354,41 +354,40 @@ function WrapContext:unwrap()
self.indent .. self.prefix self.indent .. self.prefix
) )
-- local cursor_pos = nil local cursor = nil
local row = self.brace_range.start_cursor.row local row = self.brace_range.start_cursor.row
for _, arg in ipairs(self.arg_list.args) do for i, arg in ipairs(self.arg_list.args) do
-- local on_last_row = i == #brace_range.params local on_last_arg = i == #self.arg_list.args
local line = self.indent .. arg.text local line = self.indent .. arg.text
-- if opts.tail_comma or not on_last_row then if self.opts.tail_comma or not on_last_arg then
line = line .. ',' line = line .. ','
-- end end
-- if on_last_row and not opts.wrap_closing_brace then if on_last_arg and not self.opts.wrap_closing_brace then
-- line = line .. brace_range.suffix line = line .. self.suffix
-- end 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))
-- if param.offset then -- if param.offset then
-- cursor_pos = get_cursor_pos() -- cursor = cursor
-- cursor_pos.col = cursor_pos.col + param.offset -- cursor.col = cursor.col + param.offset
-- cursor_pos.row = row + 1 -- cursor.row = row + 1
-- end -- end
row = row + 1 row = row + 1
end end
vim.fn.append(row, self.indent .. self.suffix) if self.opts.wrap_closing_brace then
vim.fn.append(row, self.indent .. self.suffix)
end
-- if opts.wrap_closing_brace then if cursor then
-- vim.fn.append(row, brace_range.indent .. brace_range.suffix) cursor:set_current()
-- end end
--
-- if cursor_pos then
-- vim.fn.setcursorcharpos({cursor_pos.row, cursor_pos.col})
-- end
end end
function WrapContext:toggle() function WrapContext:toggle()