test(config): verify Vim/Neovim config payload parity
CI / cargo fmt --check (push) Successful in 15s
CI / cargo clippy (push) Successful in 27s
CI / cargo test (push) Successful in 30s
CI / editor keymaps (push) Successful in 1m24s

Expose the init_options payload builders publicly in both clients
(M.init_options/M.server_settings in Lua, nuwiki#lsp#settings() in Vim) so
they can be inspected. Add editor harnesses that dump each client's
server-bound config as deterministic key=value lines and diff against a
shared golden file: nvim == golden and vim == golden together prove the two
clients send identical config. Add a server-side test asserting the Vim flat
shape and the Neovim {nuwiki:{...}} wrapper desugar to the same WikiConfig.
Wire both harnesses into CI.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-30 19:24:20 -03:00
parent 47af0d6c1e
commit b922f0d612
9 changed files with 319 additions and 6 deletions
+8 -6
View File
@@ -28,14 +28,16 @@ end
--- `initializationOptions` payload: the server reads it once at
--- `initialize` time via `Config::from_init_params`. This is what
--- delivers `wiki_root`/`wikis`/HTML/diary config to Rust.
local function init_options()
--- Public so the config parity harness can inspect the exact payload.
function M.init_options()
return resolved_opts()
end
--- `settings` payload: the same shape, but sent via
--- `workspace/didChangeConfiguration` after startup. Lets the server
--- pick up config changes without a restart.
local function server_settings()
--- Public so the config parity harness can inspect the exact payload.
function M.server_settings()
return { nuwiki = resolved_opts() }
end
@@ -69,8 +71,8 @@ function M.register()
cmd = command(),
filetypes = { 'vimwiki' },
root_markers = { '.git', '.nuwiki' },
init_options = init_options(),
settings = server_settings(),
init_options = M.init_options(),
settings = M.server_settings(),
})
vim.lsp.enable('nuwiki')
return
@@ -85,8 +87,8 @@ function M.register()
name = 'nuwiki',
cmd = command(),
root_dir = root_dir_for(ev.file),
init_options = init_options(),
settings = server_settings(),
init_options = M.init_options(),
settings = M.server_settings(),
})
end,
})