fix(lsp): add assertion for explicit bufnr in apply_text_edits (#27614)

Assert that the buffer number passed to apply_text_edits is fully
resolved (not 0 or null). Pass the known buffer number to
apply_text_edits from lsp.formatexpr().
This commit is contained in:
Gregory Anders
2024-02-24 19:21:57 -06:00
committed by GitHub
parent c2ddef30e7
commit 2e1f5055ac
2 changed files with 6 additions and 3 deletions

View File

@ -1280,7 +1280,7 @@ function lsp.formatexpr(opts)
local response =
client.request_sync(ms.textDocument_rangeFormatting, params, timeout_ms, bufnr)
if response and response.result then
lsp.util.apply_text_edits(response.result, 0, client.offset_encoding)
lsp.util.apply_text_edits(response.result, bufnr, client.offset_encoding)
return 0
end
end