-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Warn against unused imports #43
Comments
This kind of crosses into linter territory, I would argue. Also, doing Sort Imports removes unused imports I believe. |
Shouldn't this be closed then? Also, I agree with the decision--this is linter territory, no sense adding/maintaining that logic here as well. |
@jeffwidman yep, it should be closed 😄 |
Related issue in TypeScript repo: microsoft/TypeScript#8165 |
A very similar feature request has been added to May 2018 sprint: microsoft/vscode#15710. I hope you guys reconsider this after the API is mature in VSCode. It is true that there is a small overlap with the linter's functionality, but red squiggle under a variable/import can mean a bunch of different things, and you don't know what it is until you hover with a mouse. In contrast, grayed out variable/import is definite, leaves no room for guesses, does not require reading the message, conveys the information immediately. I suggest that you try it for yourself in PyCharm, for example, live with it for a while. Nobody likes bloated software, but this IS very useful in practice. EDIT: another related request: microsoft/vscode#20219 |
@MikhailArkhipov would it be possible to warn against unused imports in the analysis engine? |
Yes, as well as about unresolved ones. Needs some work since this info is not currently in the portable LS. I will open PTVS issues on this. |
@MikhailArkhipov Hi, about the analysis engine you're talking about, would it be a possible to remove all unused imports in the engine? |
@giyyapan detection first, then we can talk about lightbulb quick fixes. 😉 |
There are 4 parts to this |
I think in that list the priority should be a, c, d, b (as getting b to work well due to name differences between package names and the project name on PyPI is hit-or-miss). |
@AlexanderSher actually works on this (see #2049) |
Sorry as a user of vscode-python is this available yet? if so, how do I turn it on? if there's a workaround using linter, i will be just as happy to adopt. Now using pylint |
@simkimsia please follow the issues on the python-language-server repo if you would like to know when support lands in the language server. As for linters, I believe both Pylint and flake8 can warn against unused imports if you turn on their respective warning. |
It would be even better to have the "Sort and remove unused imports" like PyCharm. |
@brettcannon looks like this is done in LS? |
@Astrantia nope, this isn't done yet. |
Closing because it's being tracked here: microsoft/python-language-server#18 |
Is it possible to gray out unused imports in the same way that PyCharm does?
The text was updated successfully, but these errors were encountered: