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

mypy shows stale results #226

Open
Redoubts opened this issue Nov 28, 2023 · 3 comments
Open

mypy shows stale results #226

Redoubts opened this issue Nov 28, 2023 · 3 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug triage-needed

Comments

@Redoubts
Copy link

Redoubts commented Nov 28, 2023

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.

@karthiknadig
Copy link
Member

If you have mypy-type-checker.reportingScope set as file then we don’t update the results for all files. It only updates results for the file you are working on. Set it to workspace.

@Redoubts
Copy link
Author

Redoubts commented Nov 28, 2023

lemme see if that makes it better. Though I will say these edits usually come through other tabs in the same window. -e- (not a great solution for a large production codebase, as that increases runtime substantially)

@karthiknadig
Copy link
Member

We don't re-evaulate all open files when you make and edit in the file (scope). We do it in the workspace scope.

@karthiknadig karthiknadig self-assigned this Nov 29, 2023
@karthiknadig karthiknadig added the bug Issue identified by VS Code Team member as probable bug label Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug triage-needed
Projects
None yet
Development

No branches or pull requests

2 participants