feat(13.1-C): link helpers — pasteWikilink, pasteUrl, normalize
Closing out §13.1's smallest cluster. Three commands move from "not yet implemented" stubs to real behaviour: - `nuwiki.link.pasteWikilink` (server, executeCommand) — derives the current page name from the source URI + wiki root, returns a `WorkspaceEdit` inserting `[[<page>]]` at the requested cursor position. - `nuwiki.link.pasteUrl` (server) — same lookup, but the inserted text is the page's relative HTML output URL (`<page>.html`, including subdir segments) so the snippet survives when the export root moves. - `nuwiki.link.normalize` (client) — wraps the word at cursor as `[[word]]` without following. Reuses the `wrap_cword_as_wikilink` helper that already powers the `<CR>` two-step. Pure-VimL on the Vim path; pure-Lua on the Neovim path. No LSP round-trip. Keymaps: - `+` (normal + visual) now actually calls `normalize_link` on both editor paths instead of stubbing with a "deferred" notification. Tests: - 5 new Rust unit tests in `cluster_c_link_helpers.rs` covering command-list presence + the page-name derivation for root and subdirectory pages + the URL / wikilink shape strings. - Neovim keymap harness gains a `links.normalize_via_+` case (20 passing now, up from 19). Vim harness inherits the same command-presence check via its existing smoke tests. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -237,6 +237,17 @@ vim.defer_fn(function()
|
||||
wait_ms = 200,
|
||||
})
|
||||
|
||||
-- ===== Link helpers (§13.1 Cluster C) =====
|
||||
|
||||
run('links.normalize_via_+', {
|
||||
lines = { 'MyPage rest' },
|
||||
cursor = { 1, 3 },
|
||||
keys = '+',
|
||||
expect_line = '[[MyPage]] rest',
|
||||
expect_at = 1,
|
||||
wait_ms = 200,
|
||||
})
|
||||
|
||||
-- ===== Bullet continuation (o/O) =====
|
||||
|
||||
run('lists.o_continues_list_marker', {
|
||||
|
||||
Reference in New Issue
Block a user