Unused imports

Francesco Mecca me at francescomecca.eu
Thu Jan 30 16:56:24 UTC 2020


On Thursday, 30 January 2020 at 16:23:54 UTC, Michael wrote:
> Is there a way to detect unused imports?
>
> It happened to me that I used imports which I did not need in 
> the end. So, I'd like to remove them easily.

https://issues.dlang.org/show_bug.cgi?id=20442

TL;DR
This has come up in the past and the typical answer was: "This 
should be implemented as a third party tool using dmd as a 
library".

It is a problem that there are no currently available tools to do 
that (maybe visual-d greys out unused imports) but I do agree 
that it should be provided as a third party.

Such a functionality could end up in:
https://github.com/dlang-community/D-Scanner

and it is also a good first time project for a beginner in the D 
ecosystem.


More information about the Digitalmars-d-learn mailing list