diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-19 20:31:32 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-19 20:31:32 -0300 |
| commit | 0db34fbf28e70c8c6a3c6025c0888fc5ec75201c (patch) | |
| tree | f2e288668decded9276ebc45907f16d651b06f9e /dev/Lsp.zig | |
| parent | 2ab05b536bc3b063666b5aaab497157adc2a9120 (diff) | |
| parent | bf351b62e8843a3d173cedeefa2dd0b8ef4b4392 (diff) | |
| download | pardes-0db34fbf28e70c8c6a3c6025c0888fc5ec75201c.tar.gz pardes-0db34fbf28e70c8c6a3c6025c0888fc5ec75201c.zip | |
integration: a pane's and a view's slot as types, with the regular-expression fixes and the fixes the real loops asked for: pardes-ids (Pane.Id and View.Id through the entries, the events, the effects, the Host table and the device messages) and pardes-merge21, merged without a textual conflict; one call site written since on the old type follows (core/draw.zig: the twin test's file_changed event, .pane = .at(0)); tui core-test 848/991 (143 skipped), shell-test 1027/1030, the window builds; gates in the coordinator's ledger
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'dev/Lsp.zig')
| -rw-r--r-- | dev/Lsp.zig | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/dev/Lsp.zig b/dev/Lsp.zig index edc99eeb..4b8bfa03 100644 --- a/dev/Lsp.zig +++ b/dev/Lsp.zig @@ -5,7 +5,7 @@ const filesystem = @import("core").filesystem; pub const Request = struct { id: u32, kind: pardes.lsp.Kind, - pane: u8, + pane: pardes.Pane.Id, offset: u32, arg: []const u8, }; @@ -45,8 +45,8 @@ pub const Job = struct { // Copy before starting a worker; the editor may replace any source slice afterward. pub fn snapshot(gpa: std.mem.Allocator, core: *const pardes.Pardes, req: Request) !*Job { - if (req.pane >= core.panes.len) return error.NoPane; - const pane = core.panes[req.pane] orelse return error.NoPane; + if (req.pane.index() >= core.panes.len) return error.NoPane; + const pane = core.panes[req.pane.index()] orelse return error.NoPane; const file = pane.file; const job = try gpa.create(Job); errdefer gpa.destroy(job); @@ -87,7 +87,7 @@ pub fn snapshot(gpa: std.mem.Allocator, core: *const pardes.Pardes, req: Request var copied: usize = 0; for (core.panes, 0..) |slot, i| { const other = slot orelse continue; - if (i == req.pane) continue; + if (i == req.pane.index()) continue; const f = other.file orelse continue; if (f.output != null) continue; if (copied + f.content.len > pardes.memory.limits.lsp_snapshot_bytes) continue; @@ -173,7 +173,7 @@ test "a snapshot owns every byte the backend will read" { const job = try snapshot(gpa, core, .{ .id = 7, .kind = .status, - .pane = @intCast(core.view().active), + .pane = .at(core.view().active), .offset = 0, .arg = &needle, }); @@ -202,7 +202,7 @@ test "LSP snapshot frees every partially copied field on allocation failure" { const job = try snapshot(gpa, p, .{ .id = 7, .kind = .hover, - .pane = @intCast(p.view().active), + .pane = .at(p.view().active), .offset = 6, .arg = "query", }); @@ -226,7 +226,7 @@ test "LSP snapshots translate explicit OS paths once and retain virtual names" { const replacement = try gpa.dupe(u8, case.path); gpa.free(pane.file.?.path); pane.file.?.path = replacement; - const job = try snapshot(gpa, core, .{ .id = 1, .kind = .hover, .pane = @intCast(core.view().active), .offset = 0, .arg = "" }); + const job = try snapshot(gpa, core, .{ .id = 1, .kind = .hover, .pane = .at(core.view().active), .offset = 0, .arg = "" }); defer job.free(gpa); try std.testing.expectEqualStrings(case.native, job.path); try std.testing.expectEqualStrings(std.Io.Dir.path.dirname(case.native).?, job.root); @@ -247,7 +247,7 @@ test "a pane that is gone yields no job rather than a null deref" { try std.testing.expectError(error.NoPane, snapshot(gpa, core, .{ .id = 1, .kind = .definition, - .pane = empty, + .pane = .at(empty), .offset = 0, .arg = "", })); @@ -272,7 +272,7 @@ test "work consumes the job and hands its rows to the sink" { const job = try snapshot(gpa, core, .{ .id = 42, .kind = .status, - .pane = @intCast(core.view().active), + .pane = .at(core.view().active), .offset = 0, .arg = "", }); @@ -320,7 +320,7 @@ test "LSP edit query failure leaves text and undo untouched before a successful const job = try snapshot(failing.allocator(), core, .{ .id = core.lsp_ask.wait.?.id, .kind = kind, - .pane = @intCast(core.view().active), + .pane = .at(core.view().active), .offset = 6, .arg = "renamed", }); @@ -389,7 +389,7 @@ test "LSP work delivers failure when transferring result ownership cannot alloca } }; const core = try pardes.Pardes.init(std.testing.allocator, .{ .tty_only = true }); defer core.deinit(); - const job = try snapshot(gpa, core, .{ .id = 37, .kind = .status, .pane = @intCast(core.view().active), .offset = 0, .arg = "" }); + const job = try snapshot(gpa, core, .{ .id = 37, .kind = .status, .pane = .at(core.view().active), .offset = 0, .arg = "" }); var sink: Sink = .{}; work(std.testing.io, gpa, job, &sink, Sink.take); if (sink.rows) |rows| gpa.free(rows); |
