Skip to content

Commit a203480

Browse files
authored
fix: catch failure with undojoin after undo (#584)
1 parent 19c7ba1 commit a203480

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lua/conform/runner.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,9 @@ M.apply_format = function(
268268
if not dry_run then
269269
log.trace("Applying text edits: %s", text_edits)
270270
if undojoin then
271-
vim.cmd.undojoin()
271+
-- may fail if after undo
272+
-- Vim:E790: undojoin is not allowed after undo
273+
pcall(vim.cmd.undojoin)
272274
end
273275
vim.lsp.util.apply_text_edits(text_edits, bufnr, "utf-8")
274276
log.trace("Done formatting %s", bufname)

0 commit comments

Comments
 (0)