You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've installed the Mypy Type Checker extension, v2023.2.0.
I've created a file example.py:
def add(a: int, b: int) -> int:
return a + b
add("2", 2)
number: int = "1"
and if I run python -m mypy -m example on the command line I get the following reported type errors:
user@a18a8366e3cc:/app/src/$ python -m mypy -m example
example.py:5: error: Argument 1 to "add" has incompatible type "str"; expected "int" [arg-type]
example.py:7: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]
Found 2 errors in 1 file (checked 1 source file)
When I open the same python file in VS Code, nothing happens.
But then I'm not sure what I'm supposed to expect to happen 😅. I presume I should see the type errors highlighted in the editor, and listed in the PROBLEMS tab of the panel.
In the VS Code panel, if I go to the OUTPUT tab and select "Mypy Type Checker" I can see that the Mypy extension is watching the file. For example, I see this in the output console when I save the file:
But none of the expected type errors from the command line experiment are reported anywhere in VS Code.
There is no error highlighting in the editor window, and the PROBLEMS tab of the panel is empty also.
It would be nice to see the README updated to provide an example of expected behaviour.
The text was updated successfully, but these errors were encountered:
But none of the expected type errors from the command line experiment are reported anywhere in VS Code.
There is no error highlighting in the editor window, and the PROBLEMS tab of the panel is empty also.
I just found that there you have to enable linting in the Python extension, and set the default linter to mypy.
With this extension, you don't have to enable anything. The reason it did not work for you is due to a bug in mypy itself. I will be adding a setting to allow switching between the mypy and dmypy see here #115 . dmypy was chosen as it is designed to be performant, but it seems to be still buggy.
I've installed the Mypy Type Checker extension, v2023.2.0.
I've created a file
example.py
:and if I run
python -m mypy -m example
on the command line I get the following reported type errors:When I open the same python file in VS Code, nothing happens.
But then I'm not sure what I'm supposed to expect to happen 😅. I presume I should see the type errors highlighted in the editor, and listed in the PROBLEMS tab of the panel.
In the VS Code panel, if I go to the OUTPUT tab and select "Mypy Type Checker" I can see that the Mypy extension is watching the file. For example, I see this in the output console when I save the file:
But none of the expected type errors from the command line experiment are reported anywhere in VS Code.
There is no error highlighting in the editor window, and the PROBLEMS tab of the panel is empty also.
It would be nice to see the README updated to provide an example of expected behaviour.
The text was updated successfully, but these errors were encountered: