Recent

Author Topic: A feature request or a stupid question...  (Read 422 times)

dieselnutjob

  • Full Member
  • ***
  • Posts: 141
A feature request or a stupid question...
« on: June 18, 2019, 10:55:57 pm »
There is something that I have been meaning to ask for for a long time.

If I look at a routine that calls another procedure / function, and if I want to see how that function works, then this is what I do:-

I highlight the name of it (easiest way doubleclick it).
I right click on it.
I select the first thing on the menu "Find declaration of [functionname]"
The IDE faithfully goes to the declaration of functionname and highlights it for me.
I right click on it.
I select the second thing on the menu (Find   >) then "Find procedure definition".

I must have done this about a million times over the years.
Say I can't remember where a function definition is, but I can remember some code that calls it.  The above finds it for me.

The problem:-

In my mind I am going for the "Find procedure definition" and so sometime I go straight for that second menu item instead of doing the Find Declaration bit first.  This is because in my mind I never was interested in the Declaration, I just wanted the procedure definition.

The problem is that when you make that mistake (and I have probably done it thousands of times) it takes you to the declaration of the function that you are inside, rather than the definition of the function that you have highlighted.

Why does it do that?

Please could it be that when you highlight a call to a function and do right click, Find  >, Find procedure definition that it does both both steps for you in one? and actually goes to the procedure definition of what is highlighted?

Or have I misunderstood something?

Or maybe it already changed and need to upgrade..   In which case;  sorry.

thanks, DNJ

wp

  • Hero Member
  • *****
  • Posts: 6468
Re: A feature request or a stupid question...
« Reply #1 on: June 18, 2019, 11:08:11 pm »
In "Tools" > "Options" > "Code Tools" > "General", check the box "Jump directly to method body".

This is a bit faster: Instead of right-click + click on "Find declaration" I do a CTRL-click. And to switch between interface and implementation I press SHIFT+CTRL+ARROW-UP (or DOWN).
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5785
    • wiki
Re: A feature request or a stupid question...
« Reply #2 on: June 18, 2019, 11:27:15 pm »
You can also do the "find identifier" by keys: https://wiki.lazarus.freepascal.org/Lazarus_IDE_Tools#Summary_Table_of_IDE_shortcuts

Read the rest of the page, plenty of good tools.

There also is ctrl-H (You can re-assign it to something like alt-cursor-left; or use the 4th mouse button like in web browsers) to go back to where you came from.

FTurtle

  • Sr. Member
  • ****
  • Posts: 260
Re: A feature request or a stupid question...
« Reply #3 on: June 20, 2019, 11:28:07 am »
There are many commands about which many users even not suspect. I think it is a good idea to study whole list of that commands for be able say to oneself at right moment: "I have seen there something that looks like what I need":

IDE Options / Editor / Key Mappings