Include navigation M10: clickable includes, incdir-aware defines
One line scanner feeds three consumers that can never disagree: documentLink underlines every include path, definition lands on the resolved file, and hover's define lookup narrows to definitions reachable through the hovered file's include graph (narrow, never widen; local defines always win). Resolution is own-directory then the filelist's +incdir+s in order - M1 recorded them, M10 finally spends them; angled includes skip the own-directory rung. Resolved paths are re-spelled the way the index spells them so a case-insensitive filesystem cannot make hover silently drop a reachable define (QA HIGH, fixed with a pure lookup that latches to ambiguity on collisions). Graph build: ~7ms over the 860-file corpus. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
ab7beb1e54
commit
e546d86677
13 files changed
+2069
-57
No files matched your search
@@ -20,8 +20,9 @@ looks like language knowledge in here is a bug or a `Handshake` request.
|
||||
| `textDocument/rangeFormatting` | `vlog_formatter::format_range` | Same edit shape; the LSP `Range`'s *lines* become the engine's `--lines` (round 18) |
|
||||
| `textDocument/publishDiagnostics` | `vlog_parser::parse_source_tolerant` | Pushed on `didOpen`/`didChange`/`didSave`, full-text sync |
|
||||
| `textDocument/semanticTokens/full` | `vlog_parser::tokenize` + `Semantics` | Delta-encoded, split at line boundaries |
|
||||
| `textDocument/hover` | `DefineTable`, `Semantics`, `WorkspaceIndex` | Macro body, or declaration kind + snippet |
|
||||
| `textDocument/definition` | `Semantics` then `ExternalResolutions` | `Ambiguous` returns every location |
|
||||
| `textDocument/hover` | `DefineTable`, `Semantics`, `WorkspaceIndex`, `includes::IncludeGraph` | Macro body, or declaration kind + snippet. A macro this file does not define is answered from the workspace: the definition it **reaches through its `` `include``s** when exactly one is reachable, and every candidate otherwise |
|
||||
| `textDocument/definition` | `includes::IncludeGraph`, then `Semantics`, then `ExternalResolutions` | A cursor on an `` `include`` line jumps to the resolved file's first byte; otherwise the in-file symbol table, then the workspace overlay, whose `Ambiguous` answer returns every location. See `docs/features/include-nav/README.md` |
|
||||
| `textDocument/documentLink` | `includes::IncludeGraph` | One link per **resolvable** `` `include``, covering the quoted path, target already resolved (`resolveProvider: false`). Search order: the including file's own directory, then each `+incdir+` of the configured filelist in order; the `<angled>` form skips the first rung. An include nothing answers to gets no link and no error. Same feature README |
|
||||
| `textDocument/references` | `vlog_refactor::find_references`, else `Semantics::references_of` | Cross-file when the symbol is one the workspace index holds (a module, a package, an exported member, a port); in-file for everything else, which is what keeps a local `wire` off the workspace walk. See `docs/features/references-nav/README.md` |
|
||||
| `textDocument/documentHighlight` | `pairs::analyze`, else `Semantics::references_of` | A scope keyword highlights its own closer; anything else highlights the symbol's occurrences in this file. Kind is always `Text`; neither answer means `null`, so the editor keeps its word highlighting. Same feature README |
|
||||
| `textDocument/foldingRange` | `pairs::analyze` + comment trivia | One `Region` per matched scope pair, folded through the line *before* the closer so `end`/`endmodule` stays visible, plus one `Comment` per multi-line block comment. An unmatched opener folds nothing. Same feature README |
|
||||
@@ -190,6 +191,7 @@ handler is milliseconds; the complexity of a worker pool buys nothing yet.
|
||||
|---|---|---|
|
||||
| a document's `Semantics` + tokens + diagnostics | every `didOpen`/`didChange` | one file, full recompute |
|
||||
| the `WorkspaceIndex` | `initialize`, every `didSave`, every `workspace/didChangeWatchedFiles`, and a changed `vfmt.exclude`/`vfmt.filelist` | full re-scan of the roots |
|
||||
| the `` `include`` graph | with the `WorkspaceIndex`, from the same file list | a line scan per file (~6ms over the 860-file corpus). An open buffer's *own* includes are re-resolved on every request instead, so a line just typed is clickable before the next save |
|
||||
|
||||
**Per-file recompute on every keystroke** is the strategy TODO.md §6 states
|
||||
("per-file recompute is fine at Verilog file sizes"); salsa is explicitly
|
||||
@@ -381,10 +383,15 @@ Two rules that are easy to get wrong and are tested:
|
||||
`` `ifdef``-style directive is *not* included): the file's own
|
||||
`DefineTable::latest` wins, rendered as the joined body plus the
|
||||
definition's own source lines. If this file does not define it,
|
||||
`WorkspaceIndex::find_define` supplies every workspace definition — **all
|
||||
of them, each with its file and line**, because the index models no
|
||||
`` `include`` graph and picking one silently would be a guess
|
||||
(`docs/features/workspace-index/README.md` makes the same call).
|
||||
`WorkspaceIndex::find_define` supplies every workspace definition, each
|
||||
with its file and line — and since M10 the **`` `include`` graph gets to
|
||||
narrow that list**: when the file reaches exactly one of the candidates
|
||||
through its includes (transitively, cycles included), that one is shown
|
||||
alone. When it reaches none of them, or more than one, every candidate is
|
||||
listed as before — the index still models no order of its own
|
||||
(`docs/features/workspace-index/README.md`), and the graph is only allowed
|
||||
to speak where its answer is unambiguous
|
||||
(`docs/features/include-nav/README.md`).
|
||||
2. **A reference** resolved in-file: the symbol's kind, its name, and the
|
||||
source lines its `decl_span` covers.
|
||||
3. **A reference** answered only by the workspace overlay: the kind and name,
|
||||
@@ -462,6 +469,10 @@ list to `vlog_parser::KEYWORDS`. Rationale and inventory:
|
||||
parameter names on ordered connection lists, off the same
|
||||
`instantiation_plan` completion and signature help read.
|
||||
`docs/features/inlay-hints/README.md`.
|
||||
- [x] `textDocument/documentLink` — delivered by **include-nav** (M10),
|
||||
together with the include case of `textDocument/definition` and hover's
|
||||
include-graph precedence for `` `define``.
|
||||
`docs/features/include-nav/README.md`.
|
||||
- [ ] **Not done:** editor packaging (the VS Code extension and the
|
||||
`lspconfig` snippet are their own TODO.md §6 item).
|
||||
|
||||
|
||||
Reference in new issue
Block a user