diff options
author | pommicket <pommicket@gmail.com> | 2023-09-09 21:19:26 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-09-09 21:19:26 -0400 |
commit | 16fbe87451b0ca3e8fa35fd04e0afbfab368ea65 (patch) | |
tree | dcd4c1e37b4a89173e23047f644df94a9ca92399 /lsp-parse.c | |
parent | 0dcfd5a4f1fd865c24c01b17b214e1f72e4c06fe (diff) |
fix handling of TextEdit[]
i hate microsoft so much
Diffstat (limited to 'lsp-parse.c')
-rw-r--r-- | lsp-parse.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lsp-parse.c b/lsp-parse.c index 61e44c4..e941f1a 100644 --- a/lsp-parse.c +++ b/lsp-parse.c @@ -832,12 +832,12 @@ static bool parse_workspace_edit(LSP *lsp, LSPResponse *response, const JSON *js LSPDocumentID document = 0; if (!parse_document_uri(lsp, json, uri, &document)) return false; + LSPWorkspaceChange *change = arr_addp(edit->changes); + change->type = LSP_CHANGE_EDITS; + change->data.edit.document = document; for (u32 e = 0; e < edits.len; ++e) { - LSPWorkspaceChange *change = arr_addp(edit->changes); - change->type = LSP_CHANGE_EDIT; - change->data.edit.document = document; JSONValue text_edit = json_array_get(json, edits, e); - if (!parse_text_edit(lsp, response, json, text_edit, &change->data.edit.edit)) + if (!parse_text_edit(lsp, response, json, text_edit, arr_addp(change->data.edit.edits))) return false; } } @@ -854,12 +854,12 @@ static bool parse_workspace_edit(LSP *lsp, LSPResponse *response, const JSON *js if (!parse_document_uri(lsp, json, json_object_get(json, text_document, "uri"), &document)) return false; JSONArray edits = json_object_get_array(json, change, "edits"); - for (u32 e = 0; e < edits.len; ++e) { - LSPWorkspaceChange *out = arr_addp(edit->changes); - out->type = LSP_CHANGE_EDIT; - out->data.edit.document = document; - JSONValue text_edit = json_array_get(json, edits, e); - if (!parse_text_edit(lsp, response, json, text_edit, &out->data.edit.edit)) + LSPWorkspaceChange *out = arr_addp(edit->changes); + out->type = LSP_CHANGE_EDITS; + out->data.edit.document = document; + for (u32 i = 0; i < edits.len; ++i) { + JSONValue text_edit = json_array_get(json, edits, i); + if (!parse_text_edit(lsp, response, json, text_edit, arr_addp(out->data.edit.edits))) return false; } } else if (kind.type == JSON_STRING) { |