brandon1024 / cortado.vim

Import Java classes by name, find unused import statemens, and many other goodies!
MIT License
2 stars 0 forks source link

feature: warn of unused imports #10

Closed brandon1024 closed 1 year ago

brandon1024 commented 2 years ago

This plugin isn't super smart and doesn't do any sort of lexical analysis, so building a feature like this is a bit best-effort, but I can see some real value in a feature like this.

The plugin can read import statements (right after they are filtered from the file) and see if the imported classes are referenced anywhere in the file. This should work mostly ok, I think. I don't think we should remove them (maybe we can add a configuration option to enable that), but we should definitely warn the user (with a popup would be cool!).

One thing I'm not sure about is with var/val or with newer Java features. How well will it work? We'll need to dig into that.

brandon1024 commented 2 years ago

I did a bit of digging, we should be fine with var. It doesn't require an import statement.

brandon1024 commented 1 year ago

Done!