diff options
author | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-07-14 09:15:43 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-14 09:15:43 -0700 |
commit | c31bc6ea731567db86cbe91f7c62d89c612cd3ac (patch) | |
tree | 29f482e41df490998b3eaa5a5bbc38ed84f2503e /runtime/lua/vim/lsp/handlers.lua | |
parent | 02bf251bb3f1dd55a2c6599790ae6a7772082cdd (diff) | |
download | rneovim-c31bc6ea731567db86cbe91f7c62d89c612cd3ac.tar.gz rneovim-c31bc6ea731567db86cbe91f7c62d89c612cd3ac.tar.bz2 rneovim-c31bc6ea731567db86cbe91f7c62d89c612cd3ac.zip |
fix(lsp): pass bufnr for async formatting (#15084)
the `textDocument/rangeFormatting` nad `textDocument/formatting` did not
pass bufnr to apply_text_edits, meaning edits were applied to
the user's currently active buffer. This could result in text being
applied to the wrong buffer.
Diffstat (limited to 'runtime/lua/vim/lsp/handlers.lua')
-rw-r--r-- | runtime/lua/vim/lsp/handlers.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua index 4c7cb28871..797ff762cb 100644 --- a/runtime/lua/vim/lsp/handlers.lua +++ b/runtime/lua/vim/lsp/handlers.lua @@ -223,15 +223,15 @@ M['textDocument/rename'] = function(_, _, result) end --@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_rangeFormatting -M['textDocument/rangeFormatting'] = function(_, _, result) +M['textDocument/rangeFormatting'] = function(_, _, result, _, bufnr) if not result then return end - util.apply_text_edits(result) + util.apply_text_edits(result, bufnr) end --@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting -M['textDocument/formatting'] = function(_, _, result) +M['textDocument/formatting'] = function(_, _, result, _, bufnr) if not result then return end - util.apply_text_edits(result) + util.apply_text_edits(result, bufnr) end --@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion |