Skip to content

Underline error span instead of just caret (if possible) when using --pretty #7454

Closed
@ilevkivskyi

Description

@ilevkivskyi

It would be great instead of:

mypy/semanal.py:1052: error: Argument 1 to "analyze_base_classes" of "SemanticAnalyzer"
has incompatible type "List[Node]"; expected "List[Expression]"  [arg-type]
            result = self.analyze_base_classes(bases)
                                               ^

show something like

mypy/semanal.py:1052: error: Argument 1 to "analyze_base_classes" of "SemanticAnalyzer"
has incompatible type "List[Node]"; expected "List[Expression]"  [arg-type]
            result = self.analyze_base_classes(bases)
                                               ^~~~~

We could use some heuristics and/or Python 3.8 support for end_col_offset:

    if isinstance(context, NameExpr):
        end_column = context.column + len(context.name)
    elif options.python_version >= (3, 8):
        end_column = context.end_column
    ...

This is a follow-up for #7440

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions