summaryrefslogtreecommitdiff
path: root/ide-format.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-09-09 21:19:26 -0400
committerpommicket <pommicket@gmail.com>2023-09-09 21:19:26 -0400
commit16fbe87451b0ca3e8fa35fd04e0afbfab368ea65 (patch)
treedcd4c1e37b4a89173e23047f644df94a9ca92399 /ide-format.c
parent0dcfd5a4f1fd865c24c01b17b214e1f72e4c06fe (diff)
fix handling of TextEdit[]
i hate microsoft so much
Diffstat (limited to 'ide-format.c')
-rw-r--r--ide-format.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ide-format.c b/ide-format.c
index 70103c7..8cc0059 100644
--- a/ide-format.c
+++ b/ide-format.c
@@ -58,10 +58,11 @@ void format_process_lsp_response(Ted *ted, const LSPResponse *response) {
if (buffer_lsp_document_id(buffer) != request->data.formatting.document)
return; // switched document
+ buffer_deselect(buffer);
const LSPResponseFormatting *f = &response->data.formatting;
- arr_foreach_ptr(f->edits, const LSPTextEdit, edit) {
- buffer_apply_lsp_text_edit(buffer, response, edit);
- }
+ buffer_start_edit_chain(buffer);
+ buffer_apply_lsp_text_edits(buffer, response, f->edits, arr_len(f->edits));
+ buffer_end_edit_chain(buffer);
}
void format_quit(Ted *ted) {