summaryrefslogtreecommitdiff
path: root/src/lsp/Ask.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/lsp/Ask.zig')
-rw-r--r--src/lsp/Ask.zig7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lsp/Ask.zig b/src/lsp/Ask.zig
index b00a3384..250d6dba 100644
--- a/src/lsp/Ask.zig
+++ b/src/lsp/Ask.zig
@@ -224,7 +224,10 @@ fn applyLspEdits(p: *Pardes, pane: *Pane, revision: u32, edits: []const LspEdit)
}
@memcpy(replacement[write_at..], f.content[read_at..]);
- edit.pushUndo(p, &pane.body);
+ edit.pushUndo(p, &pane.body) catch {
+ p.gpa.free(replacement);
+ return false;
+ };
panes.File.setContent(p, f, replacement);
const cursor = modal.positionAt(f.content, mapped_cursor);
pane.body.cur_row = @intCast(cursor.row);
@@ -305,7 +308,7 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void {
}
if (rows.len == 0) {
if (w.kind == .completion and pane.body.mode == .insert and pane.body.nsel == 0 and
- pane.body.cur_row == w.row and pane.body.cur_col == w.col) edit.insertTab(p, &pane.body);
+ pane.body.cur_row == w.row and pane.body.cur_col == w.col) edit.insertTab(p, &pane.body) catch |err| return p.reportError(w.pane, "complete", err);
// Nothing found fails, but for a file with no diagnostics,
// which is no failure, and a completion's Tab.
const none: ?[]const u8 = switch (w.kind) {