diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-25 10:27:05 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-25 11:58:11 -0300 |
| commit | bfdc8a9e61dd20c91b68f62187e724d1a98445a4 (patch) | |
| tree | a020fcbdc9ca8be68aa8983837accc2328f0e742 /src/pardes.zig | |
| parent | 8bcaa657b39f24f0f2457f5c28e7095d5113ba73 (diff) | |
| download | pardes-bfdc8a9e61dd20c91b68f62187e724d1a98445a4.tar.gz pardes-bfdc8a9e61dd20c91b68f62187e724d1a98445a4.zip | |
query: a language server's list is answered, not typed: one place lands on it (Diagnostics too now), the place fed as the text's places so it is tinted and n/N have it, no query pane; several open the list with the keyboard on its current row in normal mode (showCurrent: the caret on the rows is the current row, n/N take it there), its target shown, Esc in it back to the text as it was; none is a message; line 1 keeps its word as text; Diagnostics keep the keyboard in the text for ]d; lsp-client and lsprelpath step with n, their goldens the caret on the row and no insert marker
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016u3hBPFfja5pK4EBRC1UVD
Diffstat (limited to 'src/pardes.zig')
| -rw-r--r-- | src/pardes.zig | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/pardes.zig b/src/pardes.zig index a23039ef..a35d1604 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -7093,11 +7093,22 @@ pub const Pardes = struct { const from: panes.Output.Origin = .{ .query = w.kind }; const nrows = std.mem.count(u8, rows, "\n"); - if (panes.Output.traits(from).jumps and nrows == 1) { + if ((panes.Output.traits(from).jumps or w.kind == .diagnostics) and nrows == 1) { 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); + // 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); + if (!p.look_missed and spot.at.line > 0) if (p.panes[p.active]) |there| if (there.file) |*tf| if (spot.at.line <= panes.File.nlines(p.gpa, tf)) { + const ls = panes.File.lineStart(p.gpa, tf, spot.at.line - 1); + const line = tf.content[ls .. std.mem.indexOfScalarPos(u8, tf.content, ls, '\n') orelse tf.content.len]; + const col = @min(spot.at.col -| 1, line.len); + // To its end when the server said it, else the word there. + const end = if (spot.at.end_line == spot.at.line and spot.at.end_col > col) @min(spot.at.end_col, line.len) else if (look.expandedWord(line, col)) |word| word.hi else col + 1; + if (ls + end <= tf.content.len) there.places.feed(p, there, 0, &.{.{ .start = ls + col, .end = ls + end }}, ls + col); + }; // A word that asks for a list (Callers, Refs) with one answer // jumps to it with no list: where it went is said, as the list // would have shown it. A definition's jump is the answer itself. |
