neoclide / coc-python

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

Mypy errors in unexpected buffer #254

Open TatchNicolas opened 4 years ago

TatchNicolas commented 4 years ago

When a python file A(main.py in the screenshot) has no mypy error but file B(foo_module.py) does, the error in the latter is shown in the buffer of file A.

screenshot

I am not sure this is an intended behaviour, but I think showing them in import statement line makes more sense if users want mypy errors of other files to be shown.

Environment

macOS 10.15.6 neoVim v0.4.3 coc.nvim version 0.0.78-56999634f4 coc-python 1.2.12

Steps to reproduce

I included coc-settings.json and poetry config files to setup the minimum environment to reproduce this behaviour.

https://github.com/TatchNicolas/coc-mypy-wrong-buffer

  1. git clone https://github.com/TatchNicolas/coc-mypy-wrong-buffer.git && cd coc-mypy-wrong-buffer

  2. poetry install

  3. Open main.py which imports bar_module.py which imports foo_module.py which has a type hint error at line 4

  4. You'll see the type hint error in main.py on which line 4 is actually an empty line.

TatchNicolas commented 4 years ago

If you just want to silence error messages in other files, adding --follow-imports=skip to python.linting.mypyArgs works.