test(config): verify Vim/Neovim config payload parity
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:
+8
-6
@@ -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,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user