neoclide / coc-python

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

diagnostic icons not showing when "diagnostic.refreshAfterSave": true #249

Open ghost opened 4 years ago

ghost commented 4 years ago

Result from CocInfo

## versions

vim version: VIM - Vi IMproved 8.2 8020450
node version: v10.16.3
coc.nvim version: 0.0.78
coc.nvim directory: /Users/Samu/.vim/bundle/coc.nvim
term: iTerm.app
platform: darwin

## Output channel: Python

Starting Jedi Python language engine.
##########Linting Output - pylint##########
************* Module brilliant
12,7,error,E0001:invalid syntax (<unknown>, line 12) (syntax-error)

Describe the bug

in :CocConfig, when "diagnostic.refreshAfterSave": false (default value), the diagnostic error icon properly shows on the left of the line number.

Screenshot 2020-07-15 at 21 25 39

However, when "diagnostic.refreshAfterSave": true, the diagnostic error icon does not show. As you can see, the error text still shows. However, without this icon it is not easy to spot errors in the file.

Screenshot 2020-07-15 at 21 26 45

Reproduce the bug

  1. In vim, call :CocConfig
  2. Add the diagnostic.refreshAfterSave": true to coc-settings.json. Save file.
  3. Open a python file and deliberate introduce an error. Save file.

Expected result: icon showing which line has the error Actual result: no icons on the left side. Error message still appears when hovering over line.

ashb commented 3 years ago

Minimal reproduction steps for me.

Flake8 installed with pip install --user flake8

mini.vim:

  set nocompatible
  set runtimepath^=/home/ash/etc/vim/plugged/coc.nvim
  filetype plugin indent on
  syntax on
  set hidden

  call coc#config('python', {
        \ "linting.flake8Enabled":1,
        \ "linting.flake8Path": "~/.local/bin/flake8",
        \ "linting.pylintEnabled": 0,
        \ "linting.mypyEnabled": 0,
        \})
  call coc#config('diagnostic', {
        \ "refreshAfterSave": 1
        \})

example.py

fooc this is not valid
import os

os.path.

Edit with VIMINIT= nvim -u mini.vim example.py, wait a few moments for the python interpreter to be found. No diagnostic icons will appear. Edit config to set refreshAfterSave to 0 and they appear.

workspaceOutput:

##########Linting Output - flake8##########
1,9,E,E999:SyntaxError: invalid syntax
2,1,E,E402:module level import not at top of file
18,1,W,W391:blank line at end of file