Recent

Author Topic: IDE - remove unit - hae? - and I meant it?  (Read 755 times)

Nicole

  • Hero Member
  • *****
  • Posts: 1308
IDE - remove unit - hae? - and I meant it?
« on: October 31, 2022, 05:23:35 pm »
Is this a bug or a feature?

- use many units within a project
- build a huge net of functions and write "uses..." into interfaces and implementation
- unify two units (...as you think, oh, I have to use less classes)
- go to the project-inspector and remove one unit out of the project
- you thought, you have simplified your project?

Unfortunately not:
Use a search tool and find, that the "deleted" unit is still in the uses list in many implementation parts. You have to pick it out there by hand.

PascalDragon

  • Hero Member
  • *****
  • Posts: 6349
  • Compiler Developer
Re: IDE - remove unit - hae? - and I meant it?
« Reply #1 on: November 01, 2022, 08:01:56 pm »
This is neither bug nor feature. It's simply not intended for the project inspector to affect the units themselves (except maybe the main program file).

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: IDE - remove unit - hae? - and I meant it?
« Reply #2 on: November 01, 2022, 08:35:25 pm »
Whether or not the main program file lists all units used by the project is specified in the Options dialog.
Project Options -> Miscellaneous -> Main unit has Uses section containing all units of project.
If this checkbox is checked, then any change to a used unit is updated in the main project file (and not otherwise).
Also note that the editor context menu has a Refactoring -> Unused units... menu option.
That dialog searches the current unit for redundant entries in both interface and implementation uses clauses, and offers to remove all such unit references, or just the ones you select (if there are any).
Lazarus does not do this automatically. You have to invoke the functionality per unit.

 

TinyPortal © 2005-2018