forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add python.diagnostics.unresolvedImports setting and IDiagnosticsSettings interface #2049
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change to
python.linting.unresolveImportsSeverity
to line up with what we have today. Other linters too have unresolved imports (at leastPylint
).@brettcannon @MikhailArkhipov
Should we start coming up with our own error codes?
Why?
python.linting.pylintCategorySeverity
,python.linting.pep8CategorySeverity
,python.linting.flake8CategorySeverity
,python.linting.mypyCategorySeverity
.unresolve imports
asErrors
, however there's an exception to this. This would gives user the ability to ignore specific messages. Yes, this would be an enhancement, and a perfectly valid one. Event .NET does this today (Code Analysis
, no reason we shouldn't, seems wrong not to) - hence enhancement)I.e. the end goal is to be consistent with what we have today and what other linters to today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a bit different type of settings.
python.linting.pylintCategorySeverity
orpython.linting.mypyCategorySeverity
specify categories to all types of warnings. In our case, it is more detailed setting. Should it be something likepython.linting.mpaeCategorySeverity.unresolveImports
?Disabling for a specific line can be done with comments, but I don't know if it is a common practice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very common in Python, TypeScript/JavaScript.
The suggestion is to introduce
Error Codes
, this way we can be consistent with how other linters work and how we let users categorize the messages. I'm certain we'll end up with other messages. Hence the suggestion for error codes.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so with error codes, how should we specify in settings that some error should be display as hint instead of warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We provide our own categories and users choose how they are displayed in VSC. E.g. we would categorize unused imports as a warning, and then user would map earrings to errors. That's what we do today with other linters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's start with something simple, which is what we have today. No one has requested for fine grained control, not yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is very simple in this case, and additional settings are welcome by users when there is a search mechanism (like in VSC). Error code support is actually more complicated, cause it requires changes in walkers (and maybe in parser) so that we can find those codes.
@brettcannon, @MikhailArkhipov, what are your opinion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're missing the point. It's not about what's easy to implement. I don't see the point in coming up with such a fine grained setup, when we don't have anything similar in VSC today. I.e. it won't be used. Let's just KISS.
Any ways, let's discuss next week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather separate
linting
as in pylint etc from the analysis settings. User should know what exactly they are are enabling/disabling. Also, setting forlinting
would not affect.pylintrc
and the other way around, adding to confusion.Most languages have detailed settings (ex C#
CS1234
errors and warnings, C++ has the same). that can be controlled separately. They do no mix with Resharper settings (equivalent of linting in C#) or C++ Lint.I'd rather see it proper from the start than start changing and morphing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DonJayamanne is going to post his version of settings proposal :-).
@qubitron - we may need your opinion here as well.