Created
February 29, 2020 13:38
-
-
Save kmhofmann/3ddca1c7ee4276f399ca17d951aee2dc to your computer and use it in GitHub Desktop.
vim-lsp-cxx-highlight issue demonstration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Bootstrap vim-plug automatically, if not already present | |
let s:vim_plug_autoload_file = '~/.config/nvim/autoload/plug.vim' | |
if empty(glob(s:vim_plug_autoload_file)) | |
execute "!curl -fLo " . s:vim_plug_autoload_file . " --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" | |
endif | |
set encoding=utf8 | |
set ffs=unix,dos,mac | |
syntax enable | |
set background=dark | |
set termguicolors | |
set backspace=eol,start,indent | |
set hidden | |
set number | |
call plug#begin() | |
" SCENARIO 1: No semantic highlighing when only LanguageClient_neovim installed | |
Plug 'autozimu/LanguageClient-neovim', { 'branch': 'next', 'do': 'bash install.sh' } | |
Plug 'jackguo380/vim-lsp-cxx-highlight', { 'tag': '20f0f7c' } " Version with nvim-lsp support | |
" SCENARIO 2: Semantic highlighting works; only nvim-lsp installed | |
"Plug 'neovim/nvim-lsp' | |
"let s:have_nvim_lsp = 1 | |
"Plug 'jackguo380/vim-lsp-cxx-highlight', { 'tag': '20f0f7c' } " Version with nvim-lsp support | |
" SCENARIO 3: Semantic highlighting works; both nvim-lsp and LanguageClient-neovim installed | |
"Plug 'neovim/nvim-lsp' | |
"let s:have_nvim_lsp = 1 | |
"Plug 'autozimu/LanguageClient-neovim', { 'branch': 'next', 'do': 'bash install.sh' } | |
"Plug 'jackguo380/vim-lsp-cxx-highlight', { 'tag': '20f0f7c' } " Version with nvim-lsp support | |
" SCENARIO 4: Semantic highlighting WORKS; only LanguageClient-neovim installed | |
"Plug 'autozimu/LanguageClient-neovim', { 'branch': 'next', 'do': 'bash install.sh' } | |
"Plug 'jackguo380/vim-lsp-cxx-highlight', { 'tag': '71490fd' } " Version BEFORE nvim-lsp support | |
call plug#end() | |
" --- nvim-lsp options | |
if exists('s:have_nvim_lsp') | |
lua <<EOF | |
require'nvim_lsp'.ccls.setup{ init_options = { highlight = { lsRanges = true; } } } | |
EOF | |
autocmd Filetype cpp setlocal omnifunc=v:lua.vim.lsp.omnifunc | |
endif | |
" --- LanguageClient-neovim options | |
let s:ccls_settings = { 'highlight': { 'lsRanges' : v:true }, } | |
let g:LanguageClient_serverCommands = {} | |
let g:LanguageClient_serverCommands.cpp = ['ccls', '-init=' . json_encode(s:ccls_settings)] | |
let g:LanguageClient_serverCommands.c = ['ccls', '-init=' . json_encode(s:ccls_settings)] | |
setlocal completefunc=LanguageClient#complete | |
let g:lsp_cxx_hl_log_file = '/tmp/vim-lsp-cxx-hl.log' | |
let g:lsp_cxx_hl_verbose_log = 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment