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 -22
View File
@@ -296,9 +296,8 @@ function M.auto_header(bufnr)
end
local file = vim.api.nvim_buf_get_name(bufnr)
local config = require('nuwiki.config')
for i = 0, 64 do
local c = config.wiki_cfg(i)
if not c then break end
local space = ' '
for _, c in ipairs(config.wiki_list()) do
local root = vim.fn.fnamemodify(vim.fn.expand(c.root), ':p')
if root:sub(-1) ~= '/' then root = root .. '/' end
if file:sub(1, #root) == root then
@@ -308,11 +307,15 @@ function M.auto_header(bufnr)
if file == index_path or file == diary_index_path then
return
end
space = c.space or ' '
break
end
if not (config.options.wikis or vim.g.nuwiki_wikis) then break end
end
-- Convert links_space_char back to spaces for the title (vimwiki parity).
local title = vim.fn.fnamemodify(file, ':t:r')
if space ~= ' ' and space ~= '' then
title = title:gsub(vim.pesc(space), ' ')
end
vim.api.nvim_buf_set_lines(bufnr, 0, 1, false, { '= ' .. title .. ' =', '' })
end
@@ -751,25 +754,15 @@ local _symbol_order = { '-', '*', '#', '1.', '1)', 'a)', 'A)', 'i)', 'I)' }
local function detect_current_symbol()
local line = vim.api.nvim_get_current_line()
-- Match optional indent, marker, then whitespace.
local indent, marker = line:match('^(%s*)([%-%*%#]) ')
-- Non-capturing indent; capture only the marker/separator we need.
local marker = line:match('^%s*([%-%*%#]) ')
if marker then return marker end
local n
indent, n, marker = line:match('^(%s*)(%d+)([%.%)]) ')
if marker then return '1' .. marker end
-- Roman lower
indent, marker = line:match('^(%s*)([ivxlcdm]+)%) ')
if marker then return 'i)' end
-- Roman upper
indent, marker = line:match('^(%s*)([IVXLCDM]+)%) ')
if marker then return 'I)' end
-- Alpha lower (single letter or short run)
indent, marker = line:match('^(%s*)([a-z]+)%) ')
if marker then return 'a)' end
indent, marker = line:match('^(%s*)([A-Z]+)%) ')
if marker then return 'A)' end
-- Suppress unused warning
local _ = indent
local sep = line:match('^%s*%d+([%.%)]) ')
if sep then return '1' .. sep end
if line:match('^%s*[ivxlcdm]+%) ') then return 'i)' end
if line:match('^%s*[IVXLCDM]+%) ') then return 'I)' end
if line:match('^%s*[a-z]+%) ') then return 'a)' end
if line:match('^%s*[A-Z]+%) ') then return 'A)' end
return nil
end