phase 8: navigation — definition, refs, hover, completion, ws/symbol
P8 resolved (SPEC §11): lazy + background indexing with progress. Initial scan runs in a tokio task spawned from `initialized`; the server stays responsive immediately and nav features answer with partial data until the index is complete. WorkspaceIndex (`index.rs`): - Per-URI `IndexedPage` keeps name, title, headings, outgoing links. - Reverse maps: `pages_by_name`, `backlinks: HashMap<page, …>`. - `upsert` scrubs stale entries first so re-parses don't leak. - `resolve` handles Wiki + AnchorOnly link kinds against the index; other kinds (Interwiki/Diary/File/Local/Raw) fall through. - `slugify` for anchors (lowercases, collapses runs, drops trailing dashes, preserves Unicode), `page_name_from_uri` for workspace- rooted names, `walk_wiki_files` for the background scanner. Backend wiring (`lib.rs`): - `initialize` captures workspace root from `workspaceFolders` or the deprecated `root_uri`; advertises definition/references/hover/ completion (trigger `[`)/workspace_symbol providers. - `initialized` spawns the indexer, wrapped in `window/workDoneProgress` begin/end notifications. - `did_open`/`did_change` synchronously update the index alongside publishing diagnostics; `did_close` keeps the indexed projection (file may still exist on disk and other pages link to it) and only clears diagnostics + drops the live document state. Position lookup (`nav.rs`): - `lsp_to_byte_pos` translates between LSP encoding (UTF-8 or UTF-16) and our byte columns. - `find_inline_at` descends blocks → inlines → inline containers, returning the most specific inline whose span covers the cursor. Handlers: - definition: wikilinks resolve to a target URI; anchored links return the range at the matching heading. - references: backlinks of the cursor's link target, or of the current page when the cursor isn't on a link. Ranges fall back to byte-column LSP positions when the source doc isn't open. - hover: markdown preview with page title + outline (first 8 headings), or a "not in index" fallback. - completion: fires only inside an unterminated `[[ … ` on the current line; suggests every indexed page name. - workspace/symbol: case-insensitive substring over every indexed heading. Tests (20 new): slugify (basic / punctuation / Unicode / trailing dash), page-name derivation under various roots, upsert / replace / remove, resolve for Wiki + AnchorOnly, sorted `page_names`, UTF-8 passthrough + UTF-16 conversion, position lookup hits and misses. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,10 +3,10 @@
|
||||
A Vim/Neovim plugin providing full vimwiki syntax support, implemented as a
|
||||
Rust-based language server (LSP).
|
||||
|
||||
> **Status:** Phase 7 (semantic tokens) complete. The server now serves
|
||||
> `semanticTokens/full` + `/range` with custom `vimwiki*` token types and
|
||||
> `level1`..`level6` + `centered` modifiers. Navigation features and
|
||||
> editor glue still pending.
|
||||
> **Status:** Phase 8 (navigation) complete. The server now serves
|
||||
> definition, references, hover, completion, `workspace/symbol`, plus a
|
||||
> background-indexed workspace per P8. Only editor glue and the release
|
||||
> pipeline are still pending.
|
||||
|
||||
See [`SPEC.md`](./SPEC.md) for the full project specification.
|
||||
|
||||
@@ -22,8 +22,8 @@ See [`SPEC.md`](./SPEC.md) for the full project specification.
|
||||
| 5 | Renderer | ✅ done |
|
||||
| 6 | LSP Foundation | ✅ done |
|
||||
| 7 | Semantic Tokens | ✅ done |
|
||||
| 8 | Navigation | ⏳ next |
|
||||
| 9 | Editor Glue | ⏳ |
|
||||
| 8 | Navigation | ✅ done |
|
||||
| 9 | Editor Glue | ⏳ next |
|
||||
| 10 | CI/CD release pipeline | ⏳ |
|
||||
|
||||
## Repository layout
|
||||
|
||||
Reference in New Issue
Block a user