Skip to content

remove all unused imports should remove all unused imports of the file. #17878

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

Open
oriongonza opened this issue Aug 13, 2024 · 6 comments
Open
Labels
A-assists C-feature Category: feature request

Comments

@oriongonza
Copy link

oriongonza commented Aug 13, 2024

Currently it only removes all unused imports of the current use item and we have no way of doing it for the entire file.

@oriongonza oriongonza added the C-feature Category: feature request label Aug 13, 2024
@flodiebold
Copy link
Member

If you select all the use items (or the whole file), I think the assist will work on all of them. Agree that it should maybe do that by default.

@oriongonza
Copy link
Author

I haven't figured out how to do that in neovim

@ShoyuVanilla
Copy link
Member

I haven't figured out how to do that in neovim

I think that you can do that with the visual mode

@evbo
Copy link

evbo commented Jan 27, 2025

in VS Code there is no way to select all unused?

Removing all unused for a single line saves a well-caffeinated developer maybe hundredths of a second, removing all unused for the file saves seconds.

@lnicola
Copy link
Member

lnicola commented Jan 30, 2025

@evbo you can select the whole file (or just the uses), then trigger the assist. You don't have to go through each of them.

@evbo
Copy link

evbo commented Feb 8, 2025

@lnicola thanks and the only reason I don't currently do this is for some reason it also can remove more than what is unused (underlined by the yellow squiggly):

#18941

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-assists C-feature Category: feature request
Projects
None yet
Development

No branches or pull requests

5 participants