fix(review): close all 2026-06-03 codebase-review findings (R1-R18)
CI / cargo fmt --check (push) Successful in 20s
CI / cargo clippy (push) Successful in 32s
CI / cargo test (push) Successful in 38s
CI / editor keymaps (push) Successful in 1m33s

Resolves the 18 findings from the parallel codebase review, tracked in
development/vimwiki-gap.md.

Correctness / perf:
- Wiki.config -> Arc<WikiConfig> so cloning a Wiki is a refcount bump (R5)
- WorkspaceIndex::remove is no longer O(n^2): a per-source contributions
  map limits the scan to buckets the source actually wrote into (R6)
- render_color now expands color_tag_template (__STYLE__/__CONTENT__),
  consuming the previously-dead field; ColorNode documented as an
  extension point; 3 renderer tests added (R3/R4)
- wiki_root_for returns empty/nil on no-match instead of falling back to
  the first wiki (R2); auto_header honours links_space_char (R7)

Cleanup / dedup:
- Remove dead #[allow(dead_code)] stubs + uncalled pub helpers, narrow
  imports (R10/R11)
- Dedup span_of_inline x3 -> InlineNode::span() (R12)
- diary_step single read lock; page_captions single pass (R13)
- Lua auto_header loop -> wiki_list(); detect_current_symbol cleanup
  (R14/R18)

Client / docs:
- :VimwikiNormalizeLink Vim cmds -> <q-args> (R17); ftplugin header fix
  (R16); vars.vim multi-wiki limitation documented (R15)
- Document 19 config options in README.md + doc/nuwiki.txt; fix
  list_margin/shiftwidth doc and stale comments (R1/R9)
- R8 investigated, confirmed not a real bug (documented)

Verified: Neovim harness 307, Vim harness 301/18/21, Rust suite 568, all
0 failed; clippy clean; fresh parallel-agent audit found no regressions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-03 14:13:55 +00:00
parent e319b4a935
commit 3b92b11948
25 changed files with 410 additions and 236 deletions
+15 -4
View File
@@ -170,15 +170,17 @@ endfunction
" FileType autocmd. Plain Vim has no `vim.ui.select`, so use `inputlist()`.
" Absolute root (with trailing slash) of the wiki that owns `a:file`, or the
" first configured wiki as a fallback. Used by auto_chdir + search scoping.
" Absolute root (trailing slash) of the wiki that owns `a:file`, or '' when the
" file is under no configured wiki (callers no-op / fall back to CWD).
function! nuwiki#commands#wiki_root_for(file) abort
for l:w in nuwiki#commands#wiki_list()
let l:wroot = fnamemodify(expand(l:w.root), ':p')
if l:wroot[len(l:wroot) - 1:] !=# '/' | let l:wroot .= '/' | endif
if a:file[: len(l:wroot) - 1] ==# l:wroot
return l:wroot
endif
endfor
let l:wikis = nuwiki#commands#wiki_list()
return empty(l:wikis) ? '' : fnamemodify(expand(l:wikis[0].root), ':p')
return ''
endfunction
" :NuwikiAutoChdir hook — `:lcd` into the owning wiki's root (vimwiki
@@ -198,6 +200,7 @@ function! nuwiki#commands#auto_header() abort
return
endif
let l:file = expand('%:p')
let l:space = ' '
for l:c in nuwiki#commands#wiki_list()
let l:root = fnamemodify(expand(l:c.root), ':p')
if l:root[len(l:root) - 1:] !=# '/' | let l:root .= '/' | endif
@@ -207,10 +210,16 @@ function! nuwiki#commands#auto_header() abort
if l:file ==# l:index_path || l:file ==# l:diary_index_path
return
endif
let l:space = get(l:c, 'space', ' ')
break
endif
endfor
call setline(1, '= ' . expand('%:t:r') . ' =')
" Convert links_space_char back to spaces for the title (vimwiki parity).
let l:title = expand('%:t:r')
if l:space !=# ' ' && l:space !=# ''
let l:title = substitute(l:title, '\V' . escape(l:space, '\'), ' ', 'g')
endif
call setline(1, '= ' . l:title . ' =')
call append(1, '')
endfunction
@@ -596,8 +605,10 @@ function! s:wiki_cfg(n) abort
let l:diary_rel = get(l:w, 'diary_rel_path',
\ get(g:, 'nuwiki_diary_rel_path', 'diary'))
let l:diary_idx = get(l:w, 'diary_index', 'diary')
let l:space = get(l:w, 'links_space_char',
\ get(g:, 'nuwiki_links_space_char', ' '))
return { 'root': l:root, 'ext': l:ext, 'idx': l:idx,
\ 'diary_rel': l:diary_rel, 'diary_idx': l:diary_idx }
\ 'diary_rel': l:diary_rel, 'diary_idx': l:diary_idx, 'space': l:space }
endfunction
" Build the list of configured wikis as {name, root, ext, idx, diary_rel,