4d461d2425
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>
68 lines
2.1 KiB
Markdown
68 lines
2.1 KiB
Markdown
# nuwiki
|
|
|
|
A Vim/Neovim plugin providing full vimwiki syntax support, implemented as a
|
|
Rust-based language server (LSP).
|
|
|
|
> **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.
|
|
|
|
## Implementation status
|
|
|
|
| Phase | Name | Status |
|
|
|---|---|---|
|
|
| 0 | Scaffolding | ✅ done |
|
|
| 1 | Core AST | ✅ done |
|
|
| 2 | Syntax Plugin Interface | ✅ done |
|
|
| 3 | Vimwiki Lexer | ✅ done |
|
|
| 4 | Vimwiki Parser | ✅ done |
|
|
| 5 | Renderer | ✅ done |
|
|
| 6 | LSP Foundation | ✅ done |
|
|
| 7 | Semantic Tokens | ✅ done |
|
|
| 8 | Navigation | ✅ done |
|
|
| 9 | Editor Glue | ⏳ next |
|
|
| 10 | CI/CD release pipeline | ⏳ |
|
|
|
|
## Repository layout
|
|
|
|
```
|
|
nuwiki/
|
|
├── Cargo.toml workspace root
|
|
├── crates/
|
|
│ ├── nuwiki-core/ parser, AST, renderer (no editor deps)
|
|
│ ├── nuwiki-lsp/ LSP protocol bridge
|
|
│ └── nuwiki-ls/ binary that speaks LSP over stdio
|
|
├── plugin/ universal Vim/Neovim entry point
|
|
├── lua/nuwiki/ Neovim Lua glue
|
|
├── autoload/nuwiki/ Vim VimL glue
|
|
├── ftdetect/ filetype detection for .wiki
|
|
├── ftplugin/ per-buffer filetype settings
|
|
├── syntax/ static fallback highlighting
|
|
├── doc/ `:h nuwiki`
|
|
├── scripts/ build-time helpers
|
|
└── .gitea/workflows/ CI / release pipelines
|
|
```
|
|
|
|
## Building
|
|
|
|
```sh
|
|
cargo build --workspace
|
|
cargo test --workspace
|
|
```
|
|
|
|
MSRV: Rust 1.83.
|
|
|
|
## License
|
|
|
|
Dual-licensed under either of:
|
|
|
|
- Apache License, Version 2.0 ([`LICENSE-APACHE`](./LICENSE-APACHE))
|
|
- MIT license ([`LICENSE-MIT`](./LICENSE-MIT))
|
|
|
|
at your option. Unless you explicitly state otherwise, any contribution
|
|
intentionally submitted for inclusion in this work shall be dual licensed as
|
|
above, without any additional terms or conditions.
|