Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

can not make it work with nvim-lsp #47

Open
jdhao opened this issue Nov 2, 2020 · 2 comments
Open

can not make it work with nvim-lsp #47

jdhao opened this issue Nov 2, 2020 · 2 comments

Comments

@jdhao
Copy link

jdhao commented Nov 2, 2020

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.

@Badhi
Copy link

Badhi commented Apr 9, 2021

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

@mathsten

This comment has been minimized.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants