summaryrefslogtreecommitdiff
path: root/src/lsp
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-08-09 06:54:27 -0300
committerGabriel Schneider <[email protected]>2026-08-10 09:17:07 -0300
commit599dd82f96b9d091aae78300aa6c3fbc81f9eb69 (patch)
tree532d29eb0d79896cd730fb324df4866056306506 /src/lsp
parent628aa40f13e9bbd313b51ab625f193110aad8dd0 (diff)
downloadpardes-599dd82f96b9d091aae78300aa6c3fbc81f9eb69.tar.gz
pardes-599dd82f96b9d091aae78300aa6c3fbc81f9eb69.zip
review pass: fix the eaten Tab, drop the duplicated code, cover the gaps
Diffstat (limited to 'src/lsp')
-rw-r--r--src/lsp/lsp.zig4
-rw-r--r--src/lsp/lsp_zls.zig32
2 files changed, 7 insertions, 29 deletions
diff --git a/src/lsp/lsp.zig b/src/lsp/lsp.zig
index 0ce70869..a4489552 100644
--- a/src/lsp/lsp.zig
+++ b/src/lsp/lsp.zig
@@ -184,9 +184,7 @@ pub const supports: std.EnumSet(Kind) = backend.supports;
/// diverts to `completion` after a `.`, so in a README — or in any pane the
/// backend would refuse — it has to indent instead. The core asks rather than
/// knowing, so the list of extensions stays the backend's business.
-pub fn speaks(path: []const u8) bool {
- return backend.speaks(path);
-}
+pub const speaks = backend.speaks;
/// Name shown by the harness and in `SPC ?`. Each implementation renames it.
pub const backend_name = "zls-inproc";
diff --git a/src/lsp/lsp_zls.zig b/src/lsp/lsp_zls.zig
index eeacb5e3..dfc2db90 100644
--- a/src/lsp/lsp_zls.zig
+++ b/src/lsp/lsp_zls.zig
@@ -681,32 +681,12 @@ fn goto(
/// No spelling may contain a NEWLINE: the rows depend on line numbers being
/// identical between the repaired copy and the user's buffer (see `completion`).
///
-/// Picking between them takes TWO signals, and getting that wrong was the first
-/// version's bug twice over.
-///
-/// The parse-error count alone does not work. A repair that supplies the
-/// identifier without closing the outer construct merely TIES with the broken
-/// buffer — measured, `const z: E = .` is one error either way — so demanding
-/// a strict improvement threw the repair away in exactly the cases it was
-/// written for, and the feature only worked where the syntax was already
-/// finished. Accepting ties does not save it either: for an unclosed
-/// `switch (e) {` the bare identifier and the arrow BOTH tie at one error and
-/// only the arrow produces a switch node, so the count cannot say which helped.
-///
-/// Reachability alone does not work either. "Is the dot now an `enum_literal`
-/// the tree can be walked down to from the root" is exactly the question the
-/// repair asks, and an orphaned node answers it correctly — but several
-/// spellings can answer yes while leaving trees of very different quality, and
-/// taking the first loses candidates the cleanest spelling would have found.
-///
-/// So: reachability is a hard FILTER, the error count RANKS what survives it,
-/// the earlier spelling wins a tie, and a candidate that reaches ZERO errors
-/// ends the search because nothing can beat it. That last clause is why six
-/// spellings cost less than the three that came before them: a switch arm —
-/// the case this feature exists for — is answered by the first candidate, and
-/// only a buffer nothing repairs pays for all six. A buffer that already
-/// parses is left alone, and a dot no spelling can reach is the seam's normal
-/// "no result".
+/// Choosing between them: reachability (is the dot now an `enum_literal` the
+/// tree can be walked down to from the root) is a hard FILTER, the parse-error
+/// count RANKS what survives it, the earlier spelling wins a tie, and a
+/// candidate at ZERO errors ends the search. A buffer that already parses is
+/// left alone, and a dot no spelling can reach is the seam's normal "no
+/// result".
/// ponytail: one parse per spelling; caching the base parse is the obvious
/// next step if it ever shows up.
fn completionSource(arena: std.mem.Allocator, req: lsp.Req, tr: *Trace) [:0]const u8 {