fix(lsp): add coc.nvim dispatch path to all Vim-side LSP calls
Commands were hardwired to vim-lsp (lsp#send_request, :LspDefinition,
:LspReferences, :LspRename). Users running coc.nvim got "vim-lsp not
loaded" on every command despite the plugin correctly detecting coc.
Changes:
autoload/nuwiki/commands.vim
- Add s:has_coc() (checks CocActionAsync exists)
- Add s:coc_wrap() adapter — converts coc's (err, result) callback into
the vim-lsp notification shape {response:{result:…}} so all existing
on_notification handlers work unchanged
- s:exec(): try vim-lsp first, fall back to CocActionAsync('runCommand',
…) with arguments spread as positional params, then error if neither
- Add s:jump_definition() helper — :LspDefinition vs CocActionAsync
- Add nuwiki#commands#backlinks() — :LspReferences vs CocActionAsync
- badd_link(): coc path uses CocAction('getDefinition') to resolve the
target URI without navigating
- follow_link_or_create(): replace inline :LspDefinition checks with
s:jump_definition()
- rename_file(): :LspRename vs CocActionAsync('rename')
ftplugin/vimwiki.vim
- VimwikiFollowLink / NuwikiFollowLink: dispatch through
nuwiki#commands#follow_link_or_create() instead of :LspDefinition
- VimwikiBacklinks / NuwikiBacklinks / VWB: dispatch through
nuwiki#commands#backlinks() instead of :LspReferences
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -39,9 +39,9 @@ if !has('nvim')
|
||||
command! -buffer VimwikiDiaryNextDay call nuwiki#commands#diary_next()
|
||||
command! -buffer VimwikiDiaryPrevDay call nuwiki#commands#diary_prev()
|
||||
command! -buffer VimwikiDiaryGenerateLinks call nuwiki#commands#diary_generate_index()
|
||||
command! -buffer VimwikiFollowLink LspDefinition
|
||||
command! -buffer VimwikiBacklinks LspReferences
|
||||
command! -buffer VWB LspReferences
|
||||
command! -buffer VimwikiFollowLink call nuwiki#commands#follow_link_or_create()
|
||||
command! -buffer VimwikiBacklinks call nuwiki#commands#backlinks()
|
||||
command! -buffer VWB call nuwiki#commands#backlinks()
|
||||
command! -buffer VimwikiNextLink call nuwiki#commands#link_next()
|
||||
command! -buffer VimwikiPrevLink call nuwiki#commands#link_prev()
|
||||
command! -buffer VimwikiBaddLink call nuwiki#commands#badd_link()
|
||||
@@ -88,8 +88,8 @@ if !has('nvim')
|
||||
command! -buffer NuwikiDiaryTomorrow call nuwiki#commands#diary_tomorrow()
|
||||
command! -buffer NuwikiDiaryNext call nuwiki#commands#diary_next()
|
||||
command! -buffer NuwikiDiaryPrev call nuwiki#commands#diary_prev()
|
||||
command! -buffer NuwikiFollowLink LspDefinition
|
||||
command! -buffer NuwikiBacklinks LspReferences
|
||||
command! -buffer NuwikiFollowLink call nuwiki#commands#follow_link_or_create()
|
||||
command! -buffer NuwikiBacklinks call nuwiki#commands#backlinks()
|
||||
command! -buffer NuwikiDeleteFile call nuwiki#commands#delete_file()
|
||||
command! -buffer NuwikiRenameFile call nuwiki#commands#rename_file()
|
||||
command! -buffer NuwikiNextTask call nuwiki#commands#next_task()
|
||||
|
||||
Reference in New Issue
Block a user