Skip to content

Commit

Permalink
fix: check buffer exists before applying changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sidlatau committed Nov 20, 2022
1 parent b611bd6 commit 8554d09
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lua/lsp-format/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ M._handler = function(err, result, ctx)
M._next()
return
end
if vim.fn.bufexists(ctx.bufnr) == 0 then
M._next()
return
end
if not vim.api.nvim_buf_is_loaded(ctx.bufnr) then
vim.fn.bufload(ctx.bufnr)
vim.api.nvim_buf_set_var(ctx.bufnr, "format_changedtick", vim.api.nvim_buf_get_var(ctx.bufnr, "changedtick"))
Expand Down

0 comments on commit 8554d09

Please sign in to comment.