phase 18: multi-wiki resolver + picker commands
The Phase 11 plumbing already landed the data structures (`Wiki`
aggregate, per-wiki `WorkspaceIndex`, `wikis = [...]` config shape
with v1.0 desugaring). Phase 18 closes the user-visible gap: cross-
wiki link resolution + the picker command surface.
Cross-wiki resolution:
- `Backend::wikis_snapshot` — clone the Vec under the read lock
so commands can drop it before awaiting.
- `Backend::wiki_by_index` / `wiki_by_name` — pair with the
parser's `wiki<N>:` / `wn.<Name>:` interwiki shapes.
- `Backend::resolve_target_uri(target, source_uri)` — single entry
point for cross-wiki page lookup:
- `Wiki` / `AnchorOnly` → source wiki's index (Phase 8
behaviour preserved).
- `Interwiki` → routes to the wiki referenced by
`wiki_index` / `wiki_name`, then resolves the page in that
wiki's `pages_by_name`. Returns `None` when no wiki matches
or the page isn't indexed.
- `Backend::heading_range_for(target_uri, anchor)` — anchor lookup
on the target wiki's index. Phase 8's `goto_definition` was
computing this against the *source* wiki's index, which broke for
interwiki anchors; both `goto_definition` and `hover` are
refactored onto the new pair.
Commands:
- `nuwiki.wiki.listAll` — returns `[{ id, name, root, syntax,
file_extension }]`. Drives the picker UI.
- `nuwiki.wiki.select` — alias of `listAll` per SPEC §12.9
(selection is client-side; the server just exposes the list).
- `nuwiki.wiki.openIndex` — args `{ wiki? }` accepting an index id
(number), name (string), or numeric string. Returns
`{ uri, name, tab: false }` for `<root>/index<file_extension>`.
- `nuwiki.wiki.tabOpenIndex` — same payload but `tab: true` so
the client knows to open in a new tab/split.
- `nuwiki.wiki.gotoPage` — args `{ page, wiki? }`. Prefers an
indexed URI when the page is already known; otherwise builds
`<root>/<page><file_extension>` directly. Drives the
`:VimwikiGoto {name}` compat command.
Tests: 12 new in `phase18_multi_wiki.rs` covering parser shapes for
`wiki<N>:` / `wn.<Name>:` (and that plain `[[Home]]` stays
`LinkKind::Wiki`), multi-wiki config loading + v1.0 single-root
desugaring, `WikiId` sequential assignment, longest-prefix URI
routing for nested roots, the cross-wiki resolution semantics
(target wiki's index wins when both wikis define the same page
name), missing-wiki fallback, the COMMANDS list completeness, and a
link-kind matrix covering all nine kinds. Total 369 tests pass;
fmt + clippy clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1382,26 +1382,33 @@ Deferred because the value proposition over the existing
|
||||
`workspace/rename` flow is marginal and the editor-side support is
|
||||
inconsistent across clients.
|
||||
|
||||
### 13.3 v1.1 phases 18–19
|
||||
### 13.3 v1.1 phase 19
|
||||
|
||||
Tracked in §10 with status `⏳`. Not "missing" from earlier phases —
|
||||
they're future work in the v1.1 roadmap:
|
||||
it's future work in the v1.1 roadmap:
|
||||
|
||||
- **Phase 18** — Multi-wiki. Data structures (Wiki aggregate,
|
||||
per-wiki index) already landed in Phase 11; this phase is the
|
||||
config-shape change and the picker commands.
|
||||
- **Phase 19** — Editor glue v2: `:Vimwiki*` compat layer, default
|
||||
keymaps, text objects, folding (P14 already resolved in favour of
|
||||
LSP `foldingRange` + `foldexpr` fallback).
|
||||
|
||||
Phase 17 (HTML export commands) shipped with the focused command
|
||||
surface (`currentToHtml` / `allToHtml[Force]` / `browse` / `rss`),
|
||||
template-file + fallback resolution, the `{{date}}` / `{{root_path}}`
|
||||
/ `{{toc}}` / `{{css}}` template variables, and `did_save` auto-export
|
||||
when `auto_export = true`. `color_dic` integration with the
|
||||
`ColorNode` renderer is still open (it's only useful once `colorize`
|
||||
from §13.1 lands), as is the §13.1 `link.pasteUrl` follow-up that
|
||||
depends on the same export config.
|
||||
Earlier v1.1 phases now shipped:
|
||||
|
||||
- Phase 17 (HTML export commands) — `currentToHtml`,
|
||||
`allToHtml[Force]`, `browse`, `rss`, template-file + fallback
|
||||
resolution, `{{date}}` / `{{root_path}}` / `{{toc}}` / `{{css}}`
|
||||
template variables, and `did_save` auto-export when
|
||||
`auto_export = true`. `color_dic` integration with the `ColorNode`
|
||||
renderer is still open (only useful once §13.1 `colorize` lands),
|
||||
as is the §13.1 `link.pasteUrl` follow-up that depends on the same
|
||||
export config.
|
||||
- Phase 18 (multi-wiki) — `wikis = [...]` config shape was already
|
||||
accepted by Phase 11 plumbing; this phase added the cross-wiki
|
||||
interwiki resolver (`Backend::resolve_target_uri` /
|
||||
`heading_range_for` route `[[wiki<N>:Page]]` and
|
||||
`[[wn.<Name>:Page]]` to the destination wiki's index) and four
|
||||
picker commands: `nuwiki.wiki.listAll`, `nuwiki.wiki.select`,
|
||||
`nuwiki.wiki.openIndex`, `nuwiki.wiki.tabOpenIndex`, plus
|
||||
`nuwiki.wiki.gotoPage` for the `:VimwikiGoto` compat surface.
|
||||
|
||||
### 13.4 §9 syntax checklist status
|
||||
|
||||
|
||||
Reference in New Issue
Block a user