diff options
Diffstat (limited to 'core/lsp/Ask.zig')
| -rw-r--r-- | core/lsp/Ask.zig | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/core/lsp/Ask.zig b/core/lsp/Ask.zig index f00942b0..376b093d 100644 --- a/core/lsp/Ask.zig +++ b/core/lsp/Ask.zig @@ -113,7 +113,7 @@ pub fn lspRequest(p: *Pardes, asked: usize, kind: lsp.Kind, arg_in: []const u8) p.emit(.{ .lsp = .{ .id = p.lsp_ask.seq, .kind = kind, - .pane = @intCast(id), + .pane = .at(id), .offset = @intCast(at), .arg = .from(sent), } }); @@ -275,7 +275,7 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { // 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(w.pane); + defer if (p.fs.failures != failures) p.noteLateFailure(.at(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)})); @@ -296,7 +296,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(w.pane, buf.print("{s} {d} range(s)", .{ verb, edits.len })); + p.setMessage(.at(w.pane), buf.print("{s} {d} range(s)", .{ verb, edits.len })); } return; } @@ -308,13 +308,13 @@ 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(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(.at(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(w.pane, said.print("{s}: none", .{lspWord(w.kind)})), + .diagnostics, .workspace_diagnostics => return p.setMessage(.at(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", @@ -351,7 +351,7 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { }; if (listing and !p.look_missed) { var where: pardes.Kind.Buf(300) = .{}; - p.setMessage(v.active, where.print("{s}: the one, {s}", .{ lspWord(w.kind), place })); + p.setMessage(.at(v.active), where.print("{s}: the one, {s}", .{ lspWord(w.kind), place })); } return; } @@ -372,11 +372,11 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { 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(w.pane, lspWord(w.kind), err); + const content = p.gpa.dupe(u8, rows) catch |err| return p.reportError(.at(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(w.pane, "language response", err); + p.reportError(.at(w.pane), "language response", err); return; }; if (rows.len >= 1 << 20) memory.trim(); @@ -401,7 +401,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(w.pane, if (unrenamed > 0) + p.setMessage(.at(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})); @@ -445,7 +445,7 @@ test "Lspwhy after a Hover asks to explain that hover, in its file at its place, try std.testing.expectEqual(lsp.Kind.explain, e.lsp.kind); try std.testing.expectEqualStrings("hover ", e.lsp.arg.slice()); try std.testing.expectEqual(hover_at, e.lsp.offset); - try std.testing.expectEqual(@as(u8, 0), e.lsp.pane); + try std.testing.expectEqual(0, e.lsp.pane.index()); seen = true; }; try std.testing.expect(seen); |
