[Lazarus] Notes on 'remove unused units' codetool

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Apr 12 07:26:53 CEST 2009

On Sun, 12 Apr 2009 13:21:47 +1100
Alexander Klenin <klenin at gmail.com> wrote:

> I tried a new 'remove unused units' refactoring, and in general I
> like it. A few nits:
> 1) Tree nodes should not be editable.


> 2) After removing first unit in the uses clause, the extraneous space
> is left before the next unit name.


> 3) A 'select all' button would probably be useful


> 4) Icons used are strange. I think standard 'unit' icon should be used
> instead of current one.
>   'Implementation' icon is good, but  'Interface' icon is totally
> unrecognizable for me.

Same icons as in the code explorer. Make a proposal.

> 5) I think this should be a project-wide feature, not unit-wide. 

Beware: The algorithm does not check recursively (e.g. the inherited
initialization sections) and the .lpr file contains a lot of 'unused'
units. For example the thread manager, the memory manager or the
'interfaces' unit of the LCL.
If someone uses this dialog and simply removes all 'unused' he will
make his program unrunnable.

> I am not sure how hard it is to implement,

I know a good IDE.

> but I see two interface variants:
>   5a) (Preferably) A common tree of all units in project, with
> subtrees for each unit.

Sounds like the unit dependencies window.

>   5b) A combobox to select a unit, with a tree for the unit selected.


More information about the Lazarus mailing list