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

Use pyright-specific comment for Quick Fix... > Add '# type: ignore' to suppress warning #4494

Closed
Avasam opened this issue Jun 13, 2023 · 7 comments
Assignees
Labels
fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@Avasam
Copy link

Avasam commented Jun 13, 2023

It is not uncommon to run multiple type-checkers on the same code-base (ie mypy+pyright), especially in libraries and in typeshed.
To separate the different type errors, especially when the checkers disagree, it is possible to configure pyright to ignore # type: ignore comments.

I think it would be more productive and better serve the users of pylance, if the "Quick fix" for suppression instead used # pyright: ignore[reportedError], or at least offered it as an option.

This:
image

Simply results in:
image

@erictraut
Copy link
Contributor

You can tell pyright to ignore # type: ignore (but still honor # pyright: ignore) by setting enableTypeIgnoreComments to false in your config file.

@Avasam
Copy link
Author

Avasam commented Jun 13, 2023

You can tell pyright to ignore # type: ignore (but still honor # pyright: ignore) by setting enableTypeIgnoreComments to false in your config file.

That's what I'm doing. And the reason I'd like Pylance to offer a different quick fix to suppress warning.

@heejaechang
Copy link
Contributor

in next pre-release, if the option enableTypeIgnoreComments is false, we will show # pyright: ignore instead.

@erictraut
Copy link
Contributor

@heejaechang, will you also include the specific diagnostic rule(s) for the line (e.g. # pyright: ignore[reportGeneralTypeIssue])?

@heejaechang
Copy link
Contributor

okay

@PylanceBot PylanceBot added the fixed in next version (main) A fix has been implemented and will appear in an upcoming version label Oct 19, 2023
@heejaechang
Copy link
Contributor

This issue has been fixed in prerelease version 2023.10.41, which we've just released. You can find the changelog here: CHANGELOG.md

@Avasam
Copy link
Author

Avasam commented Oct 20, 2023

@heejaechang I just tried it on the latest pre-release, and it works, but not all the time:
image
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

4 participants