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 errors are always attributed to beginning of line #3597

Closed
msfterictraut opened this issue Dec 8, 2018 · 1 comment
Closed

mypy errors are always attributed to beginning of line #3597

msfterictraut opened this issue Dec 8, 2018 · 1 comment
Labels
area-linting feature-request Request for new features or functionality important Issue identified as high-priority

Comments

@msfterictraut
Copy link

When I enable mypy linting, all errors are attributed to the beginning of the line (column 0) like this:

screen shot 2018-12-07 at 9 16 48 pm

By default, mypy doesn't emit any column information, but it can be configured to do so using the show_column_numbers option in the configuration file or command line. If column information is emitted, the output parser should be able to take advantage of this additional information.

I was able to fix this by changing the REGEX in mypy.ts to the following:

export const REGEX = '(?<file>[^:]+):(?<line>\\d+)(:(?<column>\\d+))?: (?<type>\\w+): (?<message>.*)\\r?(\\n|$)';

With this change — and with show_column_numbers enabled, the red squiggles now correctly highlight the errant code, making the tool significantly more useful.

screen shot 2018-12-07 at 9 17 21 pm

The proposed change works both with and without show_column_numbers enabled.

If this fix is acceptable, I'm happy to submit a PR.

Environment data

  • VS Code version: 1.29.1
  • Extension version: master branch built on 7 Dec, 2018
@DonJayamanne
Copy link

The proposed change works both with and without show_column_numbers enabled.
If this fix is acceptable, I'm happy to submit a PR.

Using show_column_numbers does sound like the right thing to do.

Please feel free to submit a PR.

@DonJayamanne DonJayamanne added feature-request Request for new features or functionality area-linting needs PR and removed triage labels Dec 13, 2018
@DonJayamanne DonJayamanne removed their assignment Dec 13, 2018
@brettcannon brettcannon added important Issue identified as high-priority external contributor labels Dec 14, 2018
DonJayamanne pushed a commit that referenced this issue Dec 18, 2018
* #3597: Modified mypy linter plugin to support column numbers for reported errors.
* Add news entry
@lock lock bot locked as resolved and limited conversation to collaborators Jan 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-linting feature-request Request for new features or functionality important Issue identified as high-priority
Projects
None yet
Development

No branches or pull requests

3 participants