vim-lsp-cxx-highlight icon indicating copy to clipboard operation
vim-lsp-cxx-highlight copied to clipboard

Error happened when work with coc.nvim and vim-ccls

Open simonjoylet opened this issue 3 years ago • 0 comments

Describe the bug when open call hierarchy in preview window that is generated from vim-ccls, coc.nvim tells an error. image

Log File: there are some lines from coc.nvim

2020-11-20T19:44:14.432 ERROR (pid:124479) [node-client] - request error on "nvim_call_function" [ 'coc#do_notify', [ 'ccls', '$ccls/publishSkippedRanges', { uri: 'file://untitled:14', skippedRanges: [] } ] ] buffer does not exist! Error at NeovimClient.request (/home/jianyun.sjy/.vim/plugins/coc.nvim/build/index.js:15470:21) at NeovimClient.call (/home/jianyun.sjy/.vim/plugins/coc.nvim/build/index.js:16360:21) at /home/jianyun.sjy/.vim/plugins/coc.nvim/build/index.js:78693:44 at handleNotification (/home/jianyun.sjy/.vim/plugins/coc.nvim/build/index.js:17230:43) at processMessageQueue (/home/jianyun.sjy/.vim/plugins/coc.nvim/build/index.js:17001:17) at Immediate._onImmediate (/home/jianyun.sjy/.vim/plugins/coc.nvim/build/index.js:16988:13)

Possible Fix: I wrote a patch to correct this bug.


diff --git a/autoload/lsp_cxx_hl/client/coc.vim b/autoload/lsp_cxx_hl/client/coc.vim
index 0b3b847..1f6778c 100644
--- a/autoload/lsp_cxx_hl/client/coc.vim
+++ b/autoload/lsp_cxx_hl/client/coc.vim
@@ -29,6 +29,10 @@ function! s:doinit() abort
 endfunction

 function! s:cquery_hl(params) abort
+    if count(g:lsp_cxx_hl_ft_whitelist, &filetype) == 0
+        return
+    endif
+
     call lsp_cxx_hl#log('cquery hl:', a:params)

     call lsp_cxx_hl#notify_symbols('cquery', a:params['uri'],
@@ -36,6 +40,10 @@ function! s:cquery_hl(params) abort
 endfunction

 function! s:cquery_regions(params) abort
+    if count(g:lsp_cxx_hl_ft_whitelist, &filetype) == 0
+        return
+    endif
+
     call lsp_cxx_hl#log('cquery regions:', a:params)

     call lsp_cxx_hl#notify_skipped('cquery', a:params['uri'],
@@ -43,6 +51,10 @@ function! s:cquery_regions(params) abort
 endfunction

 function! s:ccls_hl(params) abort
+    if count(g:lsp_cxx_hl_ft_whitelist, &filetype) == 0
+        return
+    endif
+
     call lsp_cxx_hl#log('ccls hl:', a:params)

     call lsp_cxx_hl#notify_symbols('ccls', a:params['uri'],
@@ -50,6 +62,10 @@ function! s:ccls_hl(params) abort
 endfunction

 function! s:ccls_regions(params) abort
+    if count(g:lsp_cxx_hl_ft_whitelist, &filetype) == 0
+        return
+    endif
+
     call lsp_cxx_hl#log('ccls regions:', a:params)

     call lsp_cxx_hl#notify_skipped('ccls', a:params['uri'],

simonjoylet avatar Nov 20 '20 13:11 simonjoylet