fix(parity): close the 2026-06-02 re-audit config/command findings
CI / cargo fmt --check (push) Successful in 19s
CI / cargo clippy (push) Successful in 37s
CI / cargo test (push) Successful in 29s
CI / editor keymaps (push) Successful in 1m36s

Implements the remaining fourth-pass findings (gap doc updated):

- list_margin: rework to upstream's buffer-side meaning. Drop the
  nuwiki-only HTML em-margin (renderer field/method + render_page_html
  param removed) and prepend max(0, list_margin) leading spaces to every
  generated bullet in build_toc_text / build_links_text /
  build_tag_links_text / diary::build_index_body; headings stay at col 0.
  From<RawWiki> derives 0 for markdown wikis when unset. Negatives can't
  resolve 'shiftwidth' server-side, so they collapse to zero indent
  (documented divergence).

- diary_months: per-wiki Vec<String> (default 12 English names), threaded
  into the diary-index month labels; missing/empty slots fall back to the
  English name.

- diary_caption_level: widen u8 -> i8 so vimwiki's -1 (min: -1) parses;
  build_index_body clamps < 0 to base tree level 0.

- VimwikiRemoveDone: regain upstream's -range. All four defs are now
  -bang -range, dispatched via remove_done(bang, range, l1, l2) in both
  clients: ! -> whole buffer, explicit range -> new list_remove_done_range
  ({range:[l1-1,l2-1]}), else current list. Server remove_done_edit gained
  an Option<(u32,u32)> range that filters whole-doc victims by start line.

markdown_header_style is deferred: the generators emit vimwiki syntax only
(caption_line never writes markdown headers), so there's no markdown header
to attach the style to. Logged as the "generated-content is vimwiki-only"
intentional divergence pending a later markdown generated-content effort.

Tests: list_margin indent, markdown list_margin-0 default, diary_months
custom + fallback, negative caption_level clamp/parse, ranged remove-done
(server + both keymap harnesses). 553 lsp/core tests pass; clippy clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-02 10:50:38 +00:00
parent 079e7246ac
commit 9441fe918c
19 changed files with 603 additions and 202 deletions
+20
View File
@@ -669,6 +669,26 @@ call s:record(
\ 'cmd.VimwikiListChangeLvl_accepts_range_and_args',
\ 'err=' . s:lcl_err)
" ===== :VimwikiRemoveDone -bang -range =====
" Upstream is `-range`; nuwiki had `-bang` only, so `:'<,'>VimwikiRemoveDone`
" raised E481. Now `-bang -range`: a ranged invocation must parse (no E481),
" and the `!` whole-buffer form must still work. The removal is an LSP
" roundtrip (no server here), so assert only the attribute parse.
call s:set_buf(['- [X] a', '- [ ] b', '- [X] c'])
let s:rd_err = ''
try
silent 1,2VimwikiRemoveDone
silent VimwikiRemoveDone!
catch /E481/
let s:rd_err = v:exception
catch
" non-E481 (e.g. no LSP attached) is expected and fine here.
endtry
call s:record(
\ s:rd_err ==# '' ? 1 : 0,
\ 'cmd.VimwikiRemoveDone_accepts_range_and_bang',
\ 'err=' . s:rd_err)
" ===== :VimwikiToggleRejectedListItem -range =====
" Was bare (range-less): `:1,3VimwikiToggleRejectedListItem` raised E481. The
" reject is an LSP roundtrip (no server here), so assert only the attribute
+15
View File
@@ -824,6 +824,21 @@ vim.defer_fn(function()
error('range reject incomplete: ' .. vim.inspect(vim.api.nvim_buf_get_lines(0, 0, -1, false)))
end
end)
-- `:1,2VimwikiRemoveDone` — now -range (was -bang only → E481 on a ranged
-- invocation). Only done items within the range are removed; line-2 `[X]`
-- (0-indexed) outside [0,1] survives.
tobj_case('cmd.remove_done_range', function()
set_buf({ '- [X] a', '- [ ] b', '- [X] c' })
vim.cmd('1,2VimwikiRemoveDone')
local done = vim.wait(2000, function()
local ls = vim.api.nvim_buf_get_lines(0, 0, -1, false)
-- line-0 done item gone (2 lines left), line-2 done item still present.
return #ls == 2 and ls[#ls]:match('%[X%] c')
end, 30)
if not done then
error('ranged remove-done wrong: ' .. vim.inspect(vim.api.nvim_buf_get_lines(0, 0, -1, false)))
end
end)
-- `:VimwikiTable {cols} [rows]` — now -nargs=* (was -nargs=1, which dropped
-- the args entirely). A 4-col table has 5 pipes per row; 3 data rows give
-- header + separator + 3 = 5 table lines.