neoclide / coc-python

Python extension for coc.nvim, fork of vscode-python
574 stars 51 forks source link

The diagnostic information does not show up in the gutter near the line numbers #278

Closed esn89 closed 4 years ago

esn89 commented 4 years ago

Result from CocInfo

## versions

vim version: NVIM v0.4.4
node version: v10.22.0
coc.nvim version: 0.0.78
coc.nvim directory: /Users/esn89/.config/nvim/plugged/coc.nvim
term: xterm-kitty
platform: darwin

Describe the bug

The diagnostic information doesn't show up in the gutter near the number column. I notice that this happens for the coc-python and coc-yaml plugins. I don't see errors there but I see the errors printed when I do :CocCommand -> workspace.showOutput

Starting Microsoft Python language server.
[Info  - 9:57:35 AM] Analysis cache path: /Users/esn89/Library/Caches/Microsoft/Python Language Server
[Info  - 9:57:35 AM] Microsoft Python Language Server version 0.5.45.0
[Info  - 9:57:35 AM] Workspace root: /Users/esn89/Documents/Projects/commercial
[Info  - 9:57:35 AM] GetCurrentSearchPaths /Users/esn89/Documents/Projects/commercial/venv/bin/python 
[Info  - 9:57:36 AM] Interpreter search paths:
[Info  - 9:57:36 AM]     /opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7
[Info  - 9:57:36 AM]     /opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload
[Info  - 9:57:36 AM]     /Users/esn89/Documents/Projects/commercial/venv/lib/python3.7/site-packages
[Info  - 9:57:36 AM] User search paths:
##########Linting Output - flake8##########
47,89,E,E501:line too long (100 > 88 characters)
101,89,E,E501:line too long (108 > 88 characters)
107,89,E,E501:line too long (102 > 88 characters)
112,89,E,E501:line too long (98 > 88 characters)
128,89,E,E501:line too long (133 > 88 characters)
130,89,E,E501:line too long (123 > 88 characters)
132,89,E,E501:line too long (176 > 88 characters)
[Info  - 9:57:37 AM] Initializing for /Users/esn89/Documents/Projects/myproj/venv/bin/python
[Info  - 9:57:37 AM] Analysis caching mode: None.

Reproduce the bug

  1. Install coc-python (1.2.12) or coc-yaml (1.0.5) with yaml-language-server@0.10.0
  2. Either open a badly formatted python file, or badly formatted yaml file.

The Coc stuff in my vimrc:

" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
if has("patch-8.1.1564")
  " Recently vim can merge signcolumn and number column into one
  set signcolumn=number
else
  set signcolumn=yes
endif

" use <tab> for trigger completion and navigate next complete item
function! s:check_back_space() abort
  let col = col('.') - 1
  return !col || getline('.')[col - 1]  =~ '\s'
endfunction

inoremap <silent><expr> <TAB>
      \ pumvisible() ? "\<C-n>" :
      \ <SID>check_back_space() ? "\<TAB>" :
      \ coc#refresh()

inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<cr>"

" Diagnostic navigation
"nmap <silent> <Leader>l <Plug>(coc-diagnostic-prev)
"nmap <silent> <Leader>n <Plug>(coc-diagnostic-next)

" Highlight symbol under cursor on CursorHold
autocmd CursorHold * silent call CocActionAsync('highlight')
highlight CocHighlightText term=underline gui=underline guifg=#BF616A

" Smaller updatetime for CursorHold & CursorHoldI
set updatetime=300

" Remap for rename current word
nmap <leader>rn <Plug>(coc-rename)

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)

" Remap for format selected region
vmap <leader>d  <Plug>(coc-format-selected)
nmap <leader>d  <Plug>(coc-format-selected)

" hi default CocHighlightText guibg=#f9f5d7
hi default CocHighlightText guibg=#fbf1c7

"let g:coc_force_debug = 1

nnoremap <silent> K :call <SID>show_documentation()<CR>

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

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

let g:coc_node_path='/opt/local/bin/node'

The coc-settings.json:

{
    "diagnostic.errorSign": " ", "diagnostic.warningSign": "⚠",
    "diagnostic.infoSign": "☞",
    "diagnostic.hintSign": "☀",
    "diagnostic.displayByAle": true,
    "coc.preferences.hoverTarget": "float",
    "coc.preferences.formatOnSaveFiletypes": ["go"],
    "list.insertMappings": {
        "<C-x>": "action:split",
        "<C-s>": "action:vsplit"
    },
    "list.normalMappings": {
        "<C-x>": "action:split",
        "<C-s>": "action:vsplit"
    },
    "suggest.timeout": 500,
    "suggest.completionItemKindLabels": {
        "variable": "⬥",
        "function": "𝑓",
        "class": "↣",
        "interface": "☍",
        "module": "{}",
        "keyword": "≔",
        "property": "⚲",
        "value": "◰",
        "enum": "◰",
        "field": "☐",
        "method": "𝑓",
        "file": "\uf24a",
        "folder": "\uf114"
    },
    "python.linting.flake8Path": "/Users/esn89/Library/Python/3.7/bin/flake8",
    "python.linting.flake8Enabled": true,
    "python.linting.enabled": false,
    "python.jediEnabled": false,
    "python.sortImports.path": "/Users/esn89/Library/Python/3.7/bin/isort",
    "yaml.format.enable": true,
    "yaml.validate": true,
    "yaml.completion": true,
    "yaml.hover": true
}
chemzqm commented 4 years ago

Seems coc-python can't understand the error format.

esn89 commented 4 years ago

Correct, and it seems that coc-yaml doesn't output it as well. How can I fix this?

chemzqm commented 4 years ago

Should be problem of your language server, checkout https://github.com/neoclide/coc.nvim/wiki/Debug-language-server#using-output-channel

esn89 commented 4 years ago

@chemzqm

Here is the output in the log format with the "trace" verbose https://pastebin.com/ssNwViLi

It looks like the language server starts.

esn89 commented 4 years ago

Nevermind, I found the error, it was my fault.

I was experimenting with ale and had this in my coc-settings.json: "diagnostic.displayByAle": true,

I deleted it and it works.