fix(diary): complete the -count wiki selector (repair 874bdd0)
CI / cargo fmt --check (push) Successful in 30s
CI / cargo clippy (push) Successful in 38s
CI / cargo test (push) Successful in 40s
CI / editor keymaps (push) Successful in 1m37s

874bdd0 committed the diary -count feature with several Edits that had
silently no-matched, leaving the tree non-compiling and the clients
inconsistent (CI run 236 failed). This completes it:

- commands.rs: add the `wiki` field to OptionalUriArg (the previous edit
  targeted a wrong struct name) and pass None to the six resolve_diary_wiki
  callers that take no selector (date/list/step paths). Server builds clean.
- autoload/nuwiki/commands.vim + lua/nuwiki/commands.lua: actually thread the
  count through s:diary_open / _diary_open and the diary_today/today_tab/
  yesterday/tomorrow/index handlers (these edits had failed before, so the
  ftplugin defs were calling handlers that ignored/rejected the arg).
- Add the test cases the prior commit referenced but never landed:
  cmd.VimwikiMakeDiaryNote_has_count (test-keymaps.lua) +
  cmd.Vimwiki{MakeDiaryNote,DiaryIndex}_accepts_count (test-keymaps-vim.vim).
- Fix the OptUriArg→OptionalUriArg name in the gap-doc note.

Verified with CI flags: workspace test/clippy/fmt clean; lua 284, vim 272/18/21,
all 0 failed; the three new diary cases pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-31 22:25:08 +00:00
parent 874bdd0c02
commit 2da2168d88
5 changed files with 52 additions and 26 deletions
+9
View File
@@ -915,6 +915,15 @@ vim.defer_fn(function()
error('VimwikiMakeDiaryNote missing -count: ' .. vim.inspect(c))
end
end)
-- Diary-note family carries -count=0 (vimwiki's wiki selector), so
-- `:2VimwikiMakeDiaryNote` selects wiki #2 instead of raising E481.
tobj_case('cmd.VimwikiMakeDiaryNote_has_count', function()
local c = vim.api.nvim_buf_get_commands(0, {}).VimwikiMakeDiaryNote
if not c then error(':VimwikiMakeDiaryNote not defined') end
if c.count == nil or c.count == false then
error('VimwikiMakeDiaryNote missing -count: ' .. vim.inspect(c))
end
end)
-- `:VimwikiNormalizeLink 1` (the arg is upstream's visual flag; the command
-- is -nargs=? not -range, so no `'<,'>`) wraps the last visual selection.
tobj_case('cmd.normalize_link_visual_wraps_selection', function()