diff options
| author | Gabriel Schneider <[email protected]> | 2026-08-10 09:14:05 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-08-10 09:17:07 -0300 |
| commit | 38e9919a9ea9055538409b388d580c4e4c838434 (patch) | |
| tree | a51ad778189cf007857f0d207f804d59228a023e /src/lsp/lsp.zig | |
| parent | 0d66575a3c888498c7929e2ec345133628c5d63d (diff) | |
| download | pardes-38e9919a9ea9055538409b388d580c4e4c838434.tar.gz pardes-38e9919a9ea9055538409b388d580c4e4c838434.zip | |
fixed lsp rename
Diffstat (limited to 'src/lsp/lsp.zig')
| -rw-r--r-- | src/lsp/lsp.zig | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/lsp/lsp.zig b/src/lsp/lsp.zig index 90d4fc6b..29e82968 100644 --- a/src/lsp/lsp.zig +++ b/src/lsp/lsp.zig @@ -6,14 +6,14 @@ //! execution model — the same shape the pty readers already use, because a //! language query is just another thing that answers later. //! -//! Every backend renders into ONE format: `+Search` rows. A location is +//! Location answers render as `+Search` rows. A location is //! `path:LINE:COL text` — or `path:LINE:COL-ENDCOL text` where the protocol //! answered with a real range, which a look then SELECTS — and that is what //! look.zig already resolves and what n/N already steps, so a multi-result //! answer IS helix's picker and a single result IS a jump, with no picker UI -//! written for it. Free text (hover, a rename's diff) rides the same buffer as -//! plain lines. A path under `Req.root` is written relative to it and any -//! other keeps its full absolute self — see `rel`. +//! written for it. Free text (hover, formatting) rides the same buffer. Rename +//! is the one mutating answer: it emits byte ranges through `edit`, and the core +//! applies them atomically only while the source revision is still current. //! //! `query` is the ONLY thing an implementation supplies. Swapping backends is //! swapping this one function, which is also how the three competing @@ -162,6 +162,14 @@ pub fn spanRow( }) catch {}; } +/// Emit one half-open byte range for a mutating response. Rename is the only +/// current user: every other answer remains human-readable rows. Byte offsets +/// avoid converting the displayed 1-based locations back into source offsets +/// in the core, and the prefix makes malformed or mixed responses fail closed. +pub fn edit(out: *std.Io.Writer, start: usize, end: usize) void { + out.print("@edit {d} {d}\n", .{ start, end }) catch {}; +} + /// Byte offset -> (line, column), both 0-based. Every backend needs it to turn /// an AST token into a row, so it lives here rather than three times over. pub fn lineCol(source: []const u8, offset: usize) struct { line: usize, col: usize } { |
