equalsraf / neovim-qt

Neovim client library and GUI, in Qt5.
https://github.com/equalsraf/neovim-qt/wiki
ISC License
1.83k stars 171 forks source link

no color diagnostics (coc.nvim + ccls) #660

Open rafaelnp opened 4 years ago

rafaelnp commented 4 years ago

Problem

When using neovim-qt, the diagnostic information (coc.nvim + ccls (lsp for c/cc++) shows no colors, in contrast to using neovim directly, as shown in the images below:

Running neovim inside konsole:

nvim-diag-color

Running neovim-qt:

nvim-qt-diag-no-color

I could not find anything related to coc.nvim so far. Does anyone experience the same issue?

Version information

Linux: 5.4.27-1-lts (Arch Linux) neovim-qt: 0.2.15-1 neovim: 0.4.3 coc.nvim: 0.0.77-2b6373bf37 ccls: 0.20190823.5-2 nerd-fonts-dejavu-complete: 2.1.0-1

Minimal configuration

neovim + neovim-qt:


" plug - plugin manager

call plug#begin('~/.config/nvim/plugged')

Plug 'kaicataldo/material.vim'
Plug 'vim-airline/vim-airline-themes'
Plug 'myusuf3/numbers.vim'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'bling/vim-airline'

call plug#end()

" neovim + neovim-qt configuration

filetype plugin indent on
syntax enable

set cpoptions=BceF

set bg=dark

if (has("termguicolors"))
    set termguicolors
endif

let g:material_theme_style = 'darker'
let g:material_terminal_italics = 1
colorscheme material

set noshowmode               " Don't show the mode, Powerline shows it
set cursorline               " sets cursor line highlight. cool :)

if  has('nvim')
    if exists('g:GuiLoaded')
        set bg=dark
        Guifont! DejaVuSansMono\ Nerd\ Font\ Mono:h8
        GuiTabline 0
        GuiPopupmenu 0
        GuiTabline 0
    endif
endif

let g:python3_host_prog = '/usr/bin/python3'
let g:python_host_prog = '/usr/bin/python2'

"
" Plugin settings
"

" airline
if !exists('g:airline_symbols')
    let g:airline_symbols = {}
endif

let g:airline_extensions = ['branch', 'hunks', 'coc', 'tabline']

" Set airline theme manually
let g:airline_theme="murmur"

" enable/disable enhanced tabline.
let g:airline#extensions#tabline#enabled = 1

" enable/disable displaying buffers with a single tab.
let g:airline#extensions#tabline#show_buffers = 1

" configure how numbers are calculated in tab mode.
let g:airline#extensions#tabline#tab_nr_type = 1 " tab number

" enable paste detection
let g:airline_detect_paste=1

" enable/disable automatic population of the `g:airline_symbols` dictionarky
" with powerline symbols.
let g:airline_powerline_fonts=1

" change the text for when no branch is detected
let g:airline#extensions#branch#empty_message = ''

" enable/disable eclim integration, which works well with the
" |airline-syntastic| extension. >
let g:airline#extensions#eclim#enabled = 0

"
" coc.nvim
"
inoremap <silent><expr> <TAB>
    \ pumvisible() ? "\<C-n>" :
    \ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
    \ <SID>check_back_space() ? "\<TAB>" :
    \ coc#refresh()

inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"

function! s:check_back_space() abort
    let col = col('.') - 1
    return !col || getline('.')[col - 1]  =~# '\s'
endfunction

" Use <c-space> to trigger completion.
inoremap <silent><expr> <c-space> coc#refresh()

" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current
" position. Coc only does snippet and additional edit on confirm.
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"

" Use `[c` and `]c` to navigate diagnostics
nmap <silent> [c <Plug>(coc-diagnostic-prev)
nmap <silent> ]c <Plug>(coc-diagnostic-next)

" Remap keys for gotos
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)

" Use K to show documentation in preview window
nnoremap <silent> K :call <SID>show_documentation()<CR>

function! s:show_documentation()
    if (index(['vim','help'], &filetype) >= 0)
        execute 'h '.expand('<cword>')
    else
        call CocAction('doHover')
    endif
endfunction

" Highlight symbol under cursor on CursorHold
autocmd CursorHold  * silent call CocActionAsync('highlight')
autocmd CursorHoldI * silent call CocActionAsync('showSignatureHelp')

" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)

augroup mygroup
  autocmd!
  " Setup formatexpr specified filetype(s).
  autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
  " Update signature help on jump placeholder.
  autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end

" Applying codeAction to the selected region.
" Example: `<leader>aap` for current paragraph
xmap <leader>a  <Plug>(coc-codeaction-selected)
nmap <leader>a  <Plug>(coc-codeaction-selected)

" Remap keys for applying codeAction to the current line.
nmap <leader>ac  <Plug>(coc-codeaction)
" Apply AutoFix to problem on the current line.
nmap <leader>qf  <Plug>(coc-fix-current)

" Add (Neo)Vim's native statusline support.
"set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}

" 2 - coc-snippets
"

" Use <C-l> for trigger snippet expand.
imap <C-l> <Plug>(coc-snippets-expand)

" Use <C-j> for select text for visual placeholder of snippet.
vmap <C-j> <Plug>(coc-snippets-select)
"let g:coc_snippet_next = '<tab>'

" Use <C-j> for both expand and jump (make expand higher priority.)
imap <C-j> <Plug>(coc-snippets-expand-jump)
" Remap for rename current word
nmap <leader>rn <Plug>(coc-rename)

coc.nvim (coc-setting.json):


{
  "languageserver": {
    "ccls": {
      "command": "ccls",
      "filetypes": [
        "c",
        "cpp",
        "objc",
        "objcpp"
      ],
      "rootPatterns": [
        ".ccls",
        "build/compile_commands.json",
        ".vim/",
        ".git/",
        ".hg/"
      ],
      "initializationOptions": {
        "cache": {
          "directory": "/tmp/ccls"
        },
        "client": {
          "snippetSupport": true
        }
      }
    }
}
jgehrig commented 4 years ago

Two quick comments:

  1. Can you please shorten minimal.vim? The smallest possible config makes debugging easier.
  2. Can you try this scenario without ext_linegrid?

You can disable ext_linegrid with the following configuration file on Linux: ~/.config/nvim-qt/nvim-qt.conf

[General]
ext_linegrid=false
rafaelnp commented 4 years ago
  1. Can you please shorten minimal.vim? The smallest possible config makes debugging easier.
" plug - plugin manager

call plug#begin('~/.config/nvim/plugged')

Plug 'kaicataldo/material.vim'
Plug 'vim-airline/vim-airline-themes'
Plug 'myusuf3/numbers.vim'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'bling/vim-airline'

call plug#end()

" neovim + neovim-qt configuration

filetype plugin indent on
syntax enable

set cpoptions=BceF
set bg=dark

if (has("termguicolors"))
    set termguicolors
endif

let g:material_theme_style = 'darker'
let g:material_terminal_italics = 1
colorscheme material

set noshowmode
set cursorline

if  has('nvim')
    if exists('g:GuiLoaded')
        Guifont! DejaVuSansMono\ Nerd\ Font\ Mono:h8
        GuiTabline 0
        GuiPopupmenu 0
        GuiTabline 0
    endif
endif

let g:python3_host_prog = '/usr/bin/python3'
let g:python_host_prog = '/usr/bin/python2'

" Plugin settings
" airline
if !exists('g:airline_symbols')
    let g:airline_symbols = {}
endif
let g:airline_extensions = ['branch', 'coc', 'tabline']
let g:airline_theme="murmur"
let g:airline_powerline_fonts=1

Can you try this scenario without ext_linegrid?

I did, unfortunately no difference.