Recent

Author Topic: Uses list auto remove items.  (Read 1780 times)

Zath

  • Sr. Member
  • ****
  • Posts: 391
Uses list auto remove items.
« on: March 08, 2017, 02:19:21 am »
Just playing with the latest Lazarus 1.6.4 release, I'm reminded of a Delphi issue carried forward into Lazarus.
If I click a component on a form, Lazarus adds the required name to the uses clause.
If I then remove the component, there's no other component using the entry, the entry remains.
Wouldn't it be better if the IDE removes the uses entry if the last relevant component is removed ?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11181
  • Debugger - SynEdit - and more
    • wiki
Re: Uses list auto remove items.
« Reply #1 on: March 08, 2017, 02:33:17 am »
The entry may be there for other reasons. Even if no symbols are used. The other unit may have initialization that is needed. (maybe nested in uses of the other unit)

Even if you did not add that unit yourself, you may have written code somewhere that relies on the other unit's initialization.

But there is a function in the IDE "remove unused units", that will prompt you, and allow you do clean up.
(search the key map)

 

TinyPortal © 2005-2018