diff options
Diffstat (limited to 'src/lsp')
| -rw-r--r-- | src/lsp/lsp.zig | 4 | ||||
| -rw-r--r-- | src/lsp/lsp_zls.zig | 32 |
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 { |
