Skip to content

no visual indication of mypy pretty linting errors on path names of >80 chars #16836

@timforby

Description

@timforby

Environment data

  • VS Code version: 1.58.2
  • Extension version (available under the Extensions sidebar): v2021.7.1060902895 (Python)
  • OS and version: macOS Mojave - 10.14.6
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6.12, 3.7.9
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Relevant/affected Python packages and their versions: mypy==0.812
  • Relevant/affected Python-related VS Code extensions and their versions: v2021.7.1060902895
  • Value of the python.languageServer setting: Pylance

Expected behaviour

I expect squiggly lines under characters where mypy error occurs.

Actual behaviour

Output logs indicate error but there is no visual indication of a simple mypy error.

Steps to reproduce:

  1. Create file in folder or with name such that the path length is greater than >80 char long.
  2. Ensure --pretty is an argument to mypy and linting for mypy is enabled.
  3. Add following code:
x: int = 's'
  1. Note the lack of visual indication of error from mypy.

Script to reproduce:

mkdir test
cd test
echo "x: int = 's'" >> no_visual_error_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.py
echo "x: int = 's'" >> visual_error.py
echo '{
	"folders": [
		{
			"path": "."
		}
	],
	"settings": {
		"python.linting.mypyArgs": [
			"--pretty"
		],
		"python.linting.mypyEnabled": true
	}
}' >> test.code-workspace
code test.code-workspace

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

> ~/.pyenv/shims/python -m mypy --pretty ~/test/visual_error.py
cwd: ~/test
> ~/.pyenv/shims/python -m mypy --pretty ~/test/visual_error.py
cwd: ~/test
##########Linting Output - mypy##########
visual_error.py:1: error: Incompatible types in assignment (expression has type
"str", variable has type "int")
    x: int = 's'
             ^
Found 1 error in 1 file (checked 1 source file)
> ~/.pyenv/shims/python -m mypy --pretty ~/test/no_visual_error_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.py
cwd: ~/test
> ~/.pyenv/shims/python -m mypy --pretty ~/test/no_visual_error_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.py
cwd: ~/test
##########Linting Output - mypy##########
no_visual_error_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.py:1: error:
Incompatible types in assignment (expression has type "str", variable has type
"int")
    x: int = 's'
             ^
Found 1 error in 1 file (checked 1 source file)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions