Recent

Author Topic: [SOLVED] How to "Jump To" the "begin" of a method, not the declaration  (Read 2333 times)

RedOctober

  • Sr. Member
  • ****
  • Posts: 469
I've just upgraded from Lazarus 2.0.10 to 3.4.  In my old version, I can hold down the Ctrl key then click on a procedure or function call, and my cursor will jump me to the "begin" in the procedure or function who's name I clicked on.  In 3.4, when I do this, I get jumped to the declaration at the top of the unit, then I have to Ctrl+down arrow to get to the "begin".  In both versions, I have the exact same setting in Tools/ Options, Environment, Editor, Mouse, Ctrl Button = Jumps to implementation.

Is this a bug in 3.4, or is there something else I need to do to get the behavior I had in 2.0.10?

TIA.
« Last Edit: September 13, 2024, 10:43:25 pm by RedOctober »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11170
  • Debugger - SynEdit - and more
    • wiki
Re: How to "Jump To" the "begin" of a method, not the declaration
« Reply #1 on: September 13, 2024, 04:53:42 pm »
Don't know, seems to work fine for me with 3.4.

Though, I don't use this normally. I just did a once off test. That may miss something.

Ignoring if the settings are the same....
Do you have the option "jump directly to method body" enabled?

Have you tested with 
- ctrl left mouse click
- Alt cursor up
?

WooBean

  • Sr. Member
  • ****
  • Posts: 284
Re: How to "Jump To" the "begin" of a method, not the declaration
« Reply #2 on: September 13, 2024, 06:12:51 pm »
In Lazarus 3.99 (rev main_3_99-2623-g10f44cfcff) FPC 3.2.2 x86_64-win64-win32/win64 when
Tools/Options/[IDE Options]/Codetools/General/Jump directly to method body checkbox is checked - jumping works as TS expected.
« Last Edit: September 13, 2024, 06:14:40 pm by WooBean »
Platforms: Win7/64, Linux Mint Ulyssa/64

RedOctober

  • Sr. Member
  • ****
  • Posts: 469
Re: How to "Jump To" the "begin" of a method, not the declaration
« Reply #3 on: September 13, 2024, 09:52:28 pm »
Hi All, thanks for the help.  Jump works now.  I did not realize that there was another setting involved that I didn't set.

"Tools/Options/[IDE Options]/Codetools/General/Jump directly to method body checkbox is checked"

(As described by both respondents)

Markus

  • New Member
  • *
  • Posts: 22
This worked for me in version 2.x, but not after I updated to version 3.8.

I have checked Tools > Options > Codetools > General > "Jump directly to method body".

When I place my mouse cursor over a procedure call, it shows the position in the source code below as a link. When I then click on that link, it jumps to the declaration, not to the body of that procedure.

Do I miss something here?

dbannon

  • Hero Member
  • *****
  • Posts: 3352
    • tomboy-ng, a rewrite of the classic Tomboy

Certainly works on 3.6 and 3.8, main for me.

I have checked Tools > Options > Codetools > General > "Jump directly to method body".
Are you sure, could you please have another look to make sure its checked ?
[/quote]

Might be worthwhile mentioning your Operating System details....

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Markus

  • New Member
  • *
  • Posts: 22
Sorry for not seeing your reply immediately. Please look at the attached screenshots.
The operating system is Windows 10, 64-bit.


dbannon

  • Hero Member
  • *****
  • Posts: 3352
    • tomboy-ng, a rewrite of the classic Tomboy
OK Marcus, here is a suggestion.  My superficial testing indicates to me that it does work for an LCL application, ie one making a GUI app but DOES NOT work for a pure FPC application.

So wider testing is clearly necessary to track this down conclusivly. Tests with both Lazarus 3.8 and 4.0

A spare time activity !

Please folks, help here, select Tools->Options->Code_Tools and make sure "Jump directly to method body" is ticked. Hold down the control key and hover your mouse over a method call, click the underlined method name and tell us where you jump to, the declaration or implementation ?  And tell us if yours is a GUI or command line app.

Maybe there is something else different between the apps I tested, what ever it is, there is definitely something wrong here.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

paweld

  • Hero Member
  • *****
  • Posts: 1375
Jump to the procedure body does not work if the definition and body of the procedure are in the same section - in non-GUI applications there is no section, and for LCL applications it is enough that the definition and body are in the implementation section.

I checked in Lazarus 4.99-trunk
Best regards / Pozdrawiam
paweld

dbannon

  • Hero Member
  • *****
  • Posts: 3352
    • tomboy-ng, a rewrite of the classic Tomboy
Yep paweld, thats a good explanation about why we see what we see. Probably answers Markus's question.

But I consider this a bug, I expect Jump to Body to do just that !  I'll log it if anyone else agrees.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

cdbc

  • Hero Member
  • *****
  • Posts: 2150
    • http://www.cdbc.dk
Hi
@Davo: Linux -> fpc 3.3.1 -> laz 4.99 -> console-app: Jumps right to implementation.
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 3.6 up until Jan 2024 from then on it's both above &: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 4.99

dbannon

  • Hero Member
  • *****
  • Posts: 3352
    • tomboy-ng, a rewrite of the classic Tomboy
Hi
@Davo: Linux -> fpc 3.3.1 -> laz 4.99 -> console-app: Jumps right to implementation.
Regards Benny
Wow, thats interesting Benny. My tests here based on a month (or so) old Lazarus main and FPC "3.2.4" (ie the beta, fixes or what ever) compiler. I very much doubt its a FPC issue so, does that indicate its been very recently fixed ?  I'm traveling and network is pretty flacky,  Maybe I'll try tomorrow, been a long day today !

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

dbannon

  • Hero Member
  • *****
  • Posts: 3352
    • tomboy-ng, a rewrite of the classic Tomboy
No Benny, testing using Lazarus Main shows same problem. Did you try code like this, press Ctrl, move mouse cursor to line  #27 "MyClass.SomeProc();"  (on SomeProc) and click it when it becomes blue.

In my case, it jumps to the declaration (line #14) !   t should jump to line #20

Code: Pascal  [Select][+][-]
  1. program project1;
  2. {$mode objfpc}
  3. {$H+}
  4.  
  5. uses
  6.     {$IFDEF UNIX}
  7.     cthreads,
  8.     {$ENDIF}
  9.     Classes
  10.     { you can add units after this };
  11.  
  12. type TMyClass = class
  13.     public
  14.         procedure SomeProc;
  15. end;
  16.  
  17. var
  18.   MyClass : TMyClass;
  19.  
  20. procedure TMyClass.SomeProc;
  21. begin
  22.     writeln('hello');
  23. end;
  24.  
  25. begin
  26.   MyClass := TMyClass.create();
  27.   MyClass.SomeProc();
  28.   MyClass.free;
  29. end.
  30.  

I don't feel like building a main FPC on my laptop while away, and really don't see this as a FPC issue.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

cdbc

  • Hero Member
  • *****
  • Posts: 2150
    • http://www.cdbc.dk
Hi Davo
I think it's 'CodeTools' acting up or getting confused and as such it lies below my "Bagatel-Threshold"  :D
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 3.6 up until Jan 2024 from then on it's both above &: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 4.99

 

TinyPortal © 2005-2018