cb4bfae5e7
Server-side rename with cross-document link rewriting (P11's
read_or_open delivers on its promise) and the first executeCommand
entry. Plus the routing infrastructure that Phases 14-17 will hang
their own commands off of.
commands.rs:
- commands::execute(backend, name, args) dispatches by command name
and returns the WorkspaceEdit to apply.
- COMMANDS const slice is the source of truth for what's advertised
in ExecuteCommandOptions.commands.
- First entry: nuwiki.file.delete with args { uri: <Url> } returning
a WorkspaceEdit with a DeleteFile op.
rename.rs:
- compute_rename(backend, target_uri, new_name, utf8):
1. Resolve the wiki via wiki_for_uri.
2. Build new URI from wiki.root + new_name + extension.
3. Snapshot the index's backlinks for the old page name before
releasing the read lock so we don't hold it across awaits.
4. For each backlink, read_or_open the source (live state or
disk + reparse) and validate the cached span against current
text.
5. Rewrite the [[...]] segment with rewrite_wikilink_target,
preserving anchor and description.
6. Add the RenameFile op so the builder emits it before the text
edits in documentChanges ordering.
- build_new_uri handles subdirectory paths and avoids double-
appending the file extension.
- rewrite_wikilink_target is pub so other tooling can call it.
lib.rs:
- Capabilities: rename_provider + execute_command_provider listing
commands::COMMANDS.
- New rename handler: cursor-on-wikilink renames the linked page,
else the buffer's file. Delegates to rename::compute_rename.
- New execute_command handler dispatches via commands::execute, then
pushes the resulting WorkspaceEdit through client.apply_edit. On
unknown command or bad args, logs and returns null.
- read_or_open loses its allow(dead_code) attribute now that Phase
13 calls it.
- rename_target_uri helper shares index-resolution with goto_def.
Tests (11 new in phase13_rename_commands.rs):
- rewrite_wikilink_target: plain, with description, with anchor,
with both, subdirectory path, non-wikilink-text rejection.
- build_new_uri: under root, with subdirectory, extension dedup,
empty path segments skipped.
- nuwiki.file.delete builder smoke test (DocumentChanges + DeleteFile).
All 211 v1.0+Phase 11+12 tests still pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
85 lines
2.7 KiB
Markdown
85 lines
2.7 KiB
Markdown
# nuwiki
|
||
|
||
A Vim/Neovim plugin providing full vimwiki syntax support, implemented as a
|
||
Rust-based language server (LSP).
|
||
|
||
> **Status:** v1.0 (Phases 0–10) shipped — parsing, highlighting, navigation,
|
||
> editor glue, and release pipeline are all live. v1.1 (Phases 11–19) in
|
||
> progress, closing the gap to a full vimwiki replacement: tags, diary,
|
||
> server-side edit commands, link health, HTML export commands, multi-wiki,
|
||
> and the `:Vimwiki*` keymap layer.
|
||
|
||
See [`SPEC.md`](./SPEC.md) for the full project specification.
|
||
|
||
## Implementation status
|
||
|
||
### v1.0 — foundation
|
||
|
||
| 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 | ✅ done |
|
||
| 10 | CI/CD release pipeline | ✅ done |
|
||
|
||
### v1.1 — full vimwiki replacement
|
||
|
||
| Phase | Name | Status |
|
||
|---|---|---|
|
||
| 11 | Plumbing prerequisites | ✅ done |
|
||
| 12 | Tags | ✅ done |
|
||
| 13 | Workspace edits + executeCommand | ✅ done |
|
||
| 14 | List & table edit commands | ⏳ |
|
||
| 15 | Link health + TOC/index generation | ⏳ |
|
||
| 16 | Diary | ⏳ |
|
||
| 17 | HTML export commands | ⏳ |
|
||
| 18 | Multi-wiki | ⏳ |
|
||
| 19 | Editor glue v2 (`:Vimwiki*` compat, keymaps, text objects, folding) | ⏳ |
|
||
|
||
## 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.
|