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

can not make it work with nvim-lsp

Open jdhao opened this issue 4 years ago • 2 comments

Describe the bug

I have install ccls successfully and make this plugin work with vim-lsp. But I can not make it work with nvim-lspconfig.

Note that nvim-lsp has been renamed to nvim-lspconfig several month ago.

To Reproduce

Use the below config and open a test.cc file.

#include <iostream>                                
#include <vector>

int add(int a, int b);

int main() {
    /* std::vector<int> v = {1, 2, 3, 4, 5}; */    
    std::vector<int> v(10, 5);                     
    int sum = 0;                                   

    for (int i = 0; i < v.size(); i++){
        sum += v[i];
    }
    std::cout << "sum is " << sum << std::endl;
    std::cout << add(2, 3) << std::endl;
    return 0;
}

int add(int a, int b){
    return a+b;
}

Expected behavior

The extra highlight for std::cout will work.

Configuration (Fill this out):

  • Nvim version: v0.5.0-746-gf7cc3ae0b
  • Which Lsp Client is being used and Lsp Client Version: nvim-lspconfig, latest master.

The config I use:

let g:PLUGIN_HOME=expand(stdpath('data') . '/plugged')
call plug#begin(g:PLUGIN_HOME)
" Plug 'prabirshrestha/vim-lsp'                                   
Plug 'neovim/nvim-lspconfig'                                      
Plug 'jackguo380/vim-lsp-cxx-highlight'                           
call plug#end()                                                   
                                                                  
let g:lsp_cxx_hl_log_file = '/tmp/lsp-cxx-hl.log'                 
let g:lsp_cxx_hl_verbose_log = 1                                  
                                                                  
lua <<EOF                                                         
require'nvim_lsp'.ccls.setup{                                     
  init_options = {                                                
    highlight = {                                                 
      lsRanges = true;                                            
    }                                                             
  }                                                               
}                                                                 
EOF                                                                                                                  

Log File: Enable logging by adding these lines:

let g:lsp_cxx_hl_log_file = '/tmp/lsp-cxx-hl.log'
let g:lsp_cxx_hl_verbose_log = 1

Then post the contents of the log file:

Mon 02 Nov 2020 11:10:14 PM CST: lsp_cxx_hl beginning initialization...   
Mon 02 Nov 2020 11:10:14 PM CST: vim-lsp not detected
Mon 02 Nov 2020 11:10:14 PM CST: LanguageClient-neovim not detected
Mon 02 Nov 2020 11:10:14 PM CST: coc.nvim not detected
Mon 02 Nov 2020 11:10:14 PM CST: nvim-lsp successfully registered         

Note that config here for vim-lsp works as expected. So it may be an config issue for nvim-lspconfig. But I am not sure how to debug where it has gone wrong.

jdhao avatar Nov 02 '20 15:11 jdhao

Hi, By any chance did you try enabling the log of lsp? vim.lsp.set_log_level("debug")

Better to make sure that ccls is publishing $ccls/publishSemanticHighlight

Badhi avatar Apr 09 '21 03:04 Badhi

Any update on this?

I am having the same issue as OP. Additionally, I get an error message Error: ls ranges is not enabled in ccls, when opening an .c/.c++ file. My setup is identical to OP.

mathsten avatar Jun 19 '21 18:06 mathsten