Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: Mypy integration highlights errors from other files when editing a Python file #9496

Closed
ambv opened this issue Jan 9, 2020 · 3 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug regression Bug didn't exist in a previous release

Comments

@ambv
Copy link

ambv commented Jan 9, 2020

Environment data

  • VS Code version: 1.41.1 2019-12-18T14:57:51.166Z
  • Extension version (available under the Extensions sidebar): 2020.1.57204
  • OS and version: macOS Mojave 10.14.6
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.8.1
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
  • Relevant/affected Python packages and their versions: mypy 0.750
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info How to update the language server to the latest stable version #3977): JEDI

Expected behaviour

The Python code editor only highlights errors in the file in question.

Actual behaviour

The Python code editor wrongly highlights unrelated errors found in other files that Mypy checked.

Steps to reproduce:

This GIF shows the error at work (click on it to see better, Shift+Cmd+R to restart the animation). Things to notice:

  • the code was initially free of Mypy errors, as I'm showing
  • making a single type error produces Mypy errors in three files; that's expected and pretty common
  • opening one of those other files (redblue.py) will show an unrelated error on line 39 (which is actually the error from midi.py, the original file we edited)

2020-01-09 23 29 37

To reproduce this yourself, clone aiotone and configure it.

$ git clone https://github.com/ambv/aiotone
$ python3.8 -m venv /tmp/aiotone
$ source /tmp/aiotone/bin/activate
(aiotone)$ poetry install
(aiotone)$ code aiotone.code-workspace

Now, in VScode, you might need to let it know the location of your Python interpreter within your virtualenv. Then, open aiotone/midi.py and make the same mistake I did on line 39. Then, open aiotone/redblue.py and observe the Mypy error from midi.py appear on line 39 in redblue.py, too.

Observations

  1. This regression is not present in the previous release of python-vscode.
  2. When mypy.ini is not present at all, this bug does not manifest.
  3. One commit I found that might be related: 1b6fbfb
@ambv ambv added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Jan 9, 2020
@kimadeline kimadeline added P0 regression Bug didn't exist in a previous release labels Jan 9, 2020
@kimadeline kimadeline self-assigned this Jan 9, 2020
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Jan 9, 2020
@kimadeline
Copy link

Hi @ambv 👋 Thank you for reporting this issue and the thorough description, it was super helpful 👍

I can confirm that reverting #5834 makes this issue disappear, we'll add this fix to a point release (aiming for Monday).

Thanks!

@ambv
Copy link
Author

ambv commented Jan 10, 2020

Wow. A two-hour turnaround on issues is 💯

Seriously impressed. Thanks! ✨ 🍰 ✨

@karrtikr
Copy link

I can confirm it doesn't happen anymore in master. The fix should be out in the stable version next Monday.

@ghost ghost removed the needs PR label Jan 10, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jan 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug regression Bug didn't exist in a previous release
Projects
None yet
Development

No branches or pull requests

3 participants