Skip to content

Support for output message ranges, instead of just the position #12288

Closed
@DevilXD

Description

@DevilXD

Feature

Following the discussion in microsoft/vscode#142810, I propose MyPy to output a range over which a typing error occurs, instead of just the position of it. The current message with --show-column-numbers and --no-pretty looks like this:

test.py:4:5: error: Argument 1 to "foo" has incompatible type "str"; expected "int"

It'd be great if a range would be included for the column numbers, if possible:

test.py:4:5-15: error: Argument 1 to "foo" has incompatible type "str"; expected "int"

Output with --pretty could then use multiple ^ characters to visualize the range. Omitting --show-column-numbers wouldn't display column numbers at all, thus the output would remain unchanged.

Pitch

This change would allow the VSCode Python extension to output diagnostic objects with proper ranges, since the current implementation only underlines one character and makes it hard to work with, and other proposed solutions appear to be non-trivial at the very least.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions