mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
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.
This commit is contained in:
parent
02bf251bb3
commit
c31bc6ea73
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user