Skip to content

Commit

Permalink
Merge pull request #28 from lukas-reineke/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas-reineke authored Mar 10, 2022
2 parents 68f6165 + 518d35e commit 84e117b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion doc/format.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


Author: Lukas Reineke <[email protected]>
Version: 2.1.1
Version: 2.1.2

==============================================================================
CONTENTS *lsp-format*
Expand Down Expand Up @@ -86,6 +86,9 @@ the `order` list. (same logic as |vim.lsp.buf.formatting_seq_sync()|)
==============================================================================
4. CHANGELOG *lsp-format-changelog*

2.1.2
* Fix error logging

2.1.1
* Don't overwrite the buffer when currently in insert mode

Expand Down
4 changes: 3 additions & 1 deletion lua/lsp-format/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ M.setup = function(format_options)

vim.lsp.handlers["textDocument/formatting"] = function(err, result, ctx)
if err ~= nil then
vim.api.nvim_err_write(err)
local client = vim.lsp.get_client_by_id(ctx.client_id)
local client_name = client and client.name or string.format("client_id=%d", ctx.client_id)
vim.api.nvim_err_write(string.format("%s: %d: %s", client_name, err.code, err.message))
return
end
if result == nil then
Expand Down

0 comments on commit 84e117b

Please sign in to comment.