Recent

Author Topic: Auto resolver/finder of correct unit for uses section  (Read 463 times)

_Antares_

  • New Member
  • *
  • Posts: 13
Auto resolver/finder of correct unit for uses section
« on: November 17, 2024, 09:44:44 am »
Hi,

I really would love to have a feature that automatically searches the right unit to include for me, if I add some code.

Example:
Writing a new class from scratch and adding a member like
  position: TPoint;
is simple enough.

But the compiler moans that there is some unit missing for his uses section.

So, was it...
  Math, UITypes, Classes, SysUtils or maybe a LCLIntf? (*)

What I usually do is going into a unit where this type (TPoint in this example) was used already, Ctrl+Click on it and see in which file I end up, then add this to the uses clause in my file and continue the actual task.

I think this could be automated, couldn't it?

(*)Yes, it was Classes. How about TModalResult? :P

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10649
  • Debugger - SynEdit - and more
    • wiki
Re: Auto resolver/finder of correct unit for uses section
« Reply #1 on: November 17, 2024, 10:06:15 am »
Install package "Cody", and then "Show Identifier and unit dictionary" in menu "Source".

Though, it needs to learn first. Install the Package, work with the IDE for one or two weeks. Every time you navigate code (using ctrl click or alt up, or similar) it will learn.

_Antares_

  • New Member
  • *
  • Posts: 13
Re: Auto resolver/finder of correct unit for uses section
« Reply #2 on: November 17, 2024, 10:25:19 am »
@Martin_fr: Hey, nice, thanks for the hint! I'll check that out!

_Antares_

  • New Member
  • *
  • Posts: 13
Re: Auto resolver/finder of correct unit for uses section
« Reply #3 on: November 17, 2024, 11:46:56 am »
I also found out about an existing functionality in Lazarus here: https://forum.lazarus.freepascal.org/index.php/topic,62303.0.html - "Unknown Identifier Search".

Have to look for this as well.  :o

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10649
  • Debugger - SynEdit - and more
    • wiki
Re: Auto resolver/finder of correct unit for uses section
« Reply #4 on: November 17, 2024, 12:43:52 pm »
Also maybe https://wiki.freepascal.org/Lazarus_InstantSearch
I have not tried myself...

 

TinyPortal © 2005-2018