brandon1024/cortado.vim

feature: warn of unused imports

Closed this issue · 2 comments

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.

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

Done!