fix(lsp): send g:nuwiki_wikis to the server so per-wiki roots are known
The server received only wiki_root (the parent directory) and had no
knowledge of the per-wiki sub-roots configured in g:nuwiki_wikis / the
setup() wikis list. It therefore resolved all links relative to the
parent root, causing every link in a sub-wiki to appear broken.
Vim path (autoload/nuwiki/lsp.vim):
s:settings() now includes a 'wikis' key when g:nuwiki_wikis is set,
so the initialization_options and settings payloads carry the full
per-wiki config (root, diary_rel_path, file_extension, …).
Lua path (lua/nuwiki/lsp.lua):
Add resolved_opts() which merges vim.g.nuwiki_wikis into
config.options.wikis when the user configures via VimL rather than
setup({wikis=…}). init_options(), server_settings(), and the
pre-0.11 root_dir_for() fallback all use resolved_opts() so the
server receives the correct per-wiki roots in every code path.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -76,10 +76,18 @@ function! s:bin_path() abort
|
||||
endfunction
|
||||
|
||||
function! s:settings() abort
|
||||
return {
|
||||
let l:cfg = {
|
||||
\ 'wiki_root': get(g:, 'nuwiki_wiki_root', '~/vimwiki'),
|
||||
\ 'file_extension': get(g:, 'nuwiki_file_extension', '.wiki'),
|
||||
\ 'syntax': get(g:, 'nuwiki_syntax', 'vimwiki'),
|
||||
\ 'log_level': get(g:, 'nuwiki_log_level', 'warn'),
|
||||
\ }
|
||||
" Include the per-wiki list when configured via g:nuwiki_wikis so the
|
||||
" server knows each wiki's root, diary path, etc. Without this it only
|
||||
" sees wiki_root and resolves links relative to that directory instead
|
||||
" of the individual wiki's root.
|
||||
if exists('g:nuwiki_wikis') && !empty(g:nuwiki_wikis)
|
||||
let l:cfg['wikis'] = g:nuwiki_wikis
|
||||
endif
|
||||
return l:cfg
|
||||
endfunction
|
||||
|
||||
Reference in New Issue
Block a user