microsoft / microsoft/vscode-mypy

mypy shows stale results

Open
#226 3 comments 1 reaction 1 assignee View on GitHub

@karthiknadig is already working on this.

Since Nov 29, 2023.

bug triage-needed
Dominant language
Python
Stars
150
Forks
39
Avg merge
21h 45m
Merged PRs (30d)
8

Description

For some reason, I find that the type-checker extension is showing stale results in the editor. But when I go to the output window and run the command that is being logged in my own shell, I get the correct and expected answer. This seems to happen when changes are made in another file than the one being viewed/edited.

For example:

```
2023-11-28 12:32:47.671 [info] /.../mypy --no-color-output --no-error-summary --show-absolute-path --show-column-numbers --show-error-codes --no-pretty --config-file=/.../mypy.ini --cache-dir=/.../mypy_cache --show-error-end /.../my-file.py
2023-11-28 12:32:47.671 [info] CWD Server: /.../src
2023-11-28 12:32:56.431 [info] file:///... :
/.../my-file:102:35:102:62: error: "Base" has no attribute "get_slack_instructions" [attr-defined]
/.../my-file.py:103:42:103:69: error: "Base" has no attribute "get_slack_instructions" [attr-defined]
```

```
user@host1:/.../src 2023-11-28 12:33:34
% /.../mypy --no-color-output --no-error-summary --show-absolute-path --show-column-numbers --show-error-codes --no-pretty --config-file=/.../mypy.ini --cache-dir=/.../mypy_cache --show-error-end /.../my-file.py

% # (no error)
```

Using `v2023.7.13181008` (latest pre-release), with the settings:
```
"mypy-type-checker.args": [
"--config-file=${workspaceFolder}/mypy.ini",
"--cache-dir=/.../mypy_cache"
],
"mypy-type-checker.importStrategy": "fromEnvironment",
"mypy-type-checker.preferDaemon": false,
"mypy-type-checker.path": [
"/.../mypy"
],
```
And my `mypy-type-checker` points to the mypy in the python venv set for the project.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.