diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-09 03:29:30 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-09 03:30:49 -0300 |
| commit | 84c8209d02f6830db861c3a8dde0c710c88075f0 (patch) | |
| tree | 10f77e3ab1becb5a0af4de152bb8d8e0e9ee0f03 /src/lsp | |
| parent | 446292e15d56c9c248dae5d6fde1be3a83ade82e (diff) | |
| download | pardes-84c8209d02f6830db861c3a8dde0c710c88075f0.tar.gz pardes-84c8209d02f6830db861c3a8dde0c710c88075f0.zip | |
idioms: the edit surface fails by name: the undo history (Journal.mark, Text.remember and step, File's, terminal's and edit's pushUndo and undoStep) returns error{OutOfMemory} instead of dropping an undo point, setEditText, enterInsert and insertTab return edit.Error with try where they reported each failure, Registers.put and setYank return error{OutOfMemory} instead of losing a yank, and their other-file callers decide (try under edit.Error, said on the pane by Undo, Redo, Pipe, Edit, Query, keys, look, completion, Incl and Plumb, ENOMEM or null where a 9P write answers, Ask's false); ctl.get and getFile return GetError (fs.ReadError, now named at fs.zig's surface, and InvalidName) for the *anyerror out-parameter and errno, the 9P get, Get and Edit's e mapping it as before; the OOM undo test pins the error; perf.zig's try relabels its harness hash, the three baselines re-keyed to it (their numbers the base's)
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/lsp')
| -rw-r--r-- | src/lsp/Ask.zig | 7 |
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) { |
