diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-20 19:22:32 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-20 19:51:13 -0300 |
| commit | 4e1432049765be6e793a3834c93c4cd5318e82bc (patch) | |
| tree | aa8e98c4cb2b7ee6ba33a49255fa85cab0089e2d /core/lsp/Ask.zig | |
| parent | 486f347adeed5bac6aaabe8be34e6a69bf323a62 (diff) | |
| parent | 2d75490196a9d15eff6ac471e9584101a5697afe (diff) | |
| download | pardes-4e1432049765be6e793a3834c93c4cd5318e82bc.tar.gz pardes-4e1432049765be6e793a3834c93c4cd5318e82bc.zip | |
integration: six slot fields typed, the docking vocabulary, the Mac's callbacks and consumer-test, on six small faults: pardes-slots (Pipe.PendingPipe.pane, Ask.wait.pane, theme_file_pane, ThemeFileRequest.pane as Pane.Id; Authority.view_of and Peer.view as View.Id; layout.dockFrom and the prose; macos State.callbacks; the build step consumer-test) and pardes-merge42; one conflict, in Peers.detach, where the pair's lifetime rule (daemon.keepSession) and the view's type (peer.view.index()) met on neighbouring lines: both kept; tui core-test 874/1031 (157 skipped), shell-test 1073/1076, term-test 17/17, both soaks diverged 0, unequal 0, unlisted 0, the window builds; this line carries the client's heap corruption that came with pardes-merge40 (a fix is being made): not gated further until it has it
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/lsp/Ask.zig')
| -rw-r--r-- | core/lsp/Ask.zig | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/core/lsp/Ask.zig b/core/lsp/Ask.zig index 376b093d..500f02b5 100644 --- a/core/lsp/Ask.zig +++ b/core/lsp/Ask.zig @@ -29,7 +29,7 @@ last: ?struct { kind: lsp.Kind, arg: Effect.Buf(128), serial: u32, offset: u32 } wait: ?struct { id: u32, kind: lsp.Kind, - pane: usize, + pane: Pane.Id, serial: u32, revision: u32, arg: Effect.Buf(128), @@ -103,7 +103,7 @@ pub fn lspRequest(p: *Pardes, asked: usize, kind: lsp.Kind, arg_in: []const u8) p.lsp_ask.wait = .{ .id = p.lsp_ask.seq, .kind = kind, - .pane = id, + .pane = .at(id), .serial = pane.serial, .revision = if (pane.file) |f| f.revision else 0, .arg = .from(arg), @@ -270,24 +270,25 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { const w = p.lsp_ask.wait orelse return; if (w.id != id) return; // superseded by a newer press, or the pane died p.lsp_ask.wait = null; - const pane = p.panes[w.pane] orelse return; + const asked = w.pane.index(); + const pane = p.panes[asked] orelse return; if (pane.serial != w.serial) return; // Whatever fails from here -- no answer, nothing found, no room for // its pane -- fails a 9P write that asked it too. const failures = p.fs.failures; - defer if (p.fs.failures != failures) p.noteLateFailure(.at(w.pane)); + defer if (p.fs.failures != failures) p.noteLateFailure(w.pane); var said: pardes.Kind.Buf(256) = .{}; const rows = response orelse - return p.reportFailure(w.pane, said.print("{s}: the language server did not answer", .{lspWord(w.kind)})); + return p.reportFailure(asked, said.print("{s}: the language server did not answer", .{lspWord(w.kind)})); // A backend that cannot answer it says why (`@none <why>`). if (std.mem.startsWith(u8, rows, "@none ")) { const why = std.mem.trimEnd(u8, rows["@none ".len..], "\n"); - return p.reportFailure(w.pane, said.print("{s}: {s}", .{ lspWord(w.kind), why })); + return p.reportFailure(asked, said.print("{s}: {s}", .{ lspWord(w.kind), why })); } // Index's answer is its indexer's command line, run in a command // pane (lsp_client.indexCommand). if (w.kind == .index) { - if (std.mem.startsWith(u8, rows, "@run ")) _ = exec.execute(p, w.pane, std.mem.trimEnd(u8, rows["@run ".len..], "\n")); + if (std.mem.startsWith(u8, rows, "@run ")) _ = exec.execute(p, asked, std.mem.trimEnd(u8, rows["@run ".len..], "\n")); return; } if (w.kind == .rename or w.kind == .format) { @@ -296,7 +297,7 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { if (applyLspEdits(p, pane, w.revision, edits)) { var buf: pardes.Kind.Buf(64) = .{}; const verb: []const u8 = if (w.kind == .rename) "renamed" else "formatted"; - p.setMessage(.at(w.pane), buf.print("{s} {d} range(s)", .{ verb, edits.len })); + p.setMessage(w.pane, buf.print("{s} {d} range(s)", .{ verb, edits.len })); } return; } @@ -308,19 +309,19 @@ 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.editor(), &pane.body) catch |err| return p.reportError(.at(w.pane), "complete", err); + pane.body.cur_row == w.row and pane.body.cur_col == w.col) edit.insertTab(p.editor(), &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) { .completion, .format => null, .rename => "nothing here to rename", - .diagnostics, .workspace_diagnostics => return p.setMessage(.at(w.pane), said.print("{s}: none", .{lspWord(w.kind)})), + .diagnostics, .workspace_diagnostics => return p.setMessage(w.pane, said.print("{s}: none", .{lspWord(w.kind)})), .incoming_calls => "callers not found", .outgoing_calls => "callees not found", .hover => "nothing to show: not found", else => "not found", }; - if (none) |text| p.reportFailure(w.pane, said.print("{s}: {s}", .{ lspWord(w.kind), text })); + if (none) |text| p.reportFailure(asked, said.print("{s}: {s}", .{ lspWord(w.kind), text })); return; } @@ -330,7 +331,7 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { const ln = std.mem.trimEnd(u8, rows, "\n"); const place = ln[0..panes.Output.location(ln).end]; p.look_missed = false; - look.lookAt(p, w.pane, place); + look.lookAt(p, asked, place); // The one place is the text's places, as a list's would be: tinted, // and n and N step it. const spot = look.parsePathLine(place); @@ -367,16 +368,16 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { }; if (listed) |source| if (pane.file != null and pane.query == null and !p.exec_header) { p.fs.refilled = null; - panes.Query.fillList(p, w.pane, source, rows); + panes.Query.fillList(p, asked, source, rows); p.fs.lsp_result = if (panes.Query.ofOwner(p, pane.serial)) |qid| p.panes[qid].?.serial else null; return; }; const dir = if (pane.file) |f| panes.Dir.ofName(f.path) else pane.cwdSlice(); - const content = p.gpa.dupe(u8, rows) catch |err| return p.reportError(.at(w.pane), lspWord(w.kind), err); + const content = p.gpa.dupe(u8, rows) catch |err| return p.reportError(w.pane, lspWord(w.kind), err); const serial_before = p.next_serial; p.fs.refilled = null; - panes.Output.fillResults(p, w.pane, dir, from, w.arg.slice(), content, null) catch |err| { - p.reportError(.at(w.pane), "language response", err); + panes.Output.fillResults(p, asked, dir, from, w.arg.slice(), content, null) catch |err| { + p.reportError(w.pane, "language response", err); return; }; if (rows.len >= 1 << 20) memory.trim(); @@ -390,7 +391,7 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { if (p.next_serial != serial_before) { const report_rows = std.mem.count(u8, result_pane.file.?.content, "\n"); const wanted: u16 = @intCast(@min(v.screen_h, report_rows + result_pane.tag_rows)); - layout.givePaneRows(p, result_id, wanted, w.pane); + layout.givePaneRows(p, result_id, wanted, asked); } look.focusPaneLine(p, result_id, .{ .line = 1, .col = 1 }, .keep); break; @@ -401,7 +402,7 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { // Rows that only name a file the server left alone (lsp_client // renameEdits) are no edits. const unrenamed = std.mem.count(u8, rows, ", which the server did not rename\n"); - p.setMessage(.at(w.pane), if (unrenamed > 0) + p.setMessage(w.pane, if (unrenamed > 0) said_buf.print("Rename: previewed, not applied: the server renamed in this file only, and {d} other open file(s) say the name", .{unrenamed}) else said_buf.print("Rename: {d} edit(s) across files, previewed, not applied", .{nrows})); @@ -413,7 +414,7 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { .line = @as(usize, @intCast(@max(0, w.row))) + 1, .col = @as(usize, @intCast(@max(0, w.col))) + 1, }); - _ = look.jumpResult(p, w.pane, row); + _ = look.jumpResult(p, asked, row); } } |
