Recent

Author Topic: jump to method body  (Read 1494 times)

dbannon

  • Hero Member
  • *****
  • Posts: 3071
    • tomboy-ng, a rewrite of the classic Tomboy
jump to method body
« on: August 13, 2024, 01:15:45 pm »
Somewhere in the 3.0+ release I seem to have lost the ability to "jump to method body" in the Lazarus IDE.  You know, put the cursor on a call to a method, press the appropriate keys and we jump to where that method is implemented.

There are heaps of questions on this topic in the Forum, but I think they are all out of date. The things related to this task all seem to no longer work -

  • Alt-Down arrow (does nothing, is not defined)
  • Alt-Up (jumps to method declaration)
  • Ctrl-Shift-Down (jumps to method declaration)
  • Ctrl-Click (jumps to method declaration)
  • Ctrl-RightClick (jumps to method declaration)


As I understand it, the key function, in Code Tools, is "Find Procedure Method" [Ctrl-Shift-Down] but, as noted above, it jumps to method declaration.

There is also a Code Tools setting, "jump to method body" that appears to have no effect on any of the above. From memory, in previous version, it did !

Any one like to tell me just how to map a key compo to what I want or, is there some other combo already set to do this important job ?

I am testing on Lazarus 3.0, Lazarus 3.4 (both releases) and lazarus-fixes-3_0.

Davo

« Last Edit: August 13, 2024, 01:45:51 pm by dbannon »
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

tetrastes

  • Hero Member
  • *****
  • Posts: 529
Re: jump to method body
« Reply #1 on: August 13, 2024, 02:42:37 pm »
Ctrl-Shift-Down (or Up) jumps between method declaration and method definition ("body"), Lazarus 3.2 and fixes.

paweld

  • Hero Member
  • *****
  • Posts: 1215
Re: jump to method body
« Reply #2 on: August 13, 2024, 02:52:19 pm »
tested on Lazarus 3.4 and Windows:
if "Jump directly to method body" checked in "Codetools > General" options: Alt+Up and Ctrl+Click - jump to method body; Ctrl+Shift+Down - jump to current method declaration
« Last Edit: August 13, 2024, 05:13:55 pm by paweld »
Best regards / Pozdrawiam
paweld

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10298
  • Debugger - SynEdit - and more
    • wiki
Re: jump to method body
« Reply #3 on: August 13, 2024, 04:56:14 pm »
Missing your OS... (Well found it, after I cancelled my first reply) => When the forum is in reply mode, the signature is not visible. So I don't know what you put in there . Please but it in the message. Helps a lot.


Maybe your Linux interferes with some of the hotkeys?
I have some situation, where I can only use my hotkeys with the right control+alt key, because the left side is stolen by the OS.

Of course that only applies if a shortcut does nothing. If the IDE reacts to it, just different than expected then it likely wasn't the OS (but could be key mapping / I.e. if you don't use qwerty, or have special oem key layout)


Quote
Any one like to tell me just how to map a key compo to what I want or, is there some other combo already set to do this important job

All key mappings are under Tools > options > editor > Keymap

You can filter by grabbing a key combo (and that also tells you if Lazarus receives it, or if the OS steals it).
Or you can filter by name.

If you then assign any new combo to any action, the IDE will tell you if it is used for something else. And you can decide if you want to change it or not.
« Last Edit: August 13, 2024, 04:58:34 pm by Martin_fr »

eny

  • Hero Member
  • *****
  • Posts: 1644
Re: jump to method body
« Reply #4 on: August 13, 2024, 05:42:57 pm »
Some crucial key combinations that work perfectly fine in other apps on Linux, don't work in Lazarus.
Most notably the ones related to the numeric keypad in combination with Ctrl/Alt/Shift.
You can redefine until the cows come home but it will never work comfortably like it works on Window$ or any other non-Lazarus app on Linux.

<<update>>
Or if you have the patience you can use the key grabber: https://forum.lazarus.freepascal.org/index.php/topic,36255.msg241401.html#msg241401
« Last Edit: August 13, 2024, 05:47:36 pm by eny »
All posts based on: Win10 (Win64); Lazarus 3_4  (x64) 25-05-2024 (unless specified otherwise...)

Thaddy

  • Hero Member
  • *****
  • Posts: 15646
  • Censorship about opinions does not belong here.
Re: jump to method body
« Reply #5 on: August 13, 2024, 06:33:37 pm »
If your terminal already hooked the keys, you are out of luck. Simply install another terminal. Bash seems to be OK in most situations. This has very little to do with Linux vs Fpc. You are probably using an exotic terminal.
If I smell bad code it usually is bad code and that includes my own code.

dsiders

  • Hero Member
  • *****
  • Posts: 1238
Re: jump to method body
« Reply #6 on: August 13, 2024, 06:42:55 pm »
If your terminal already hooked the keys, you are out of luck. Simply install another terminal. Bash seems to be OK in most situations. This has very little to do with Linux vs Fpc. You are probably using an exotic terminal.

It can also depend on the Window Manager / Desktop Environment. QT, for example, has global short cut keys that steal some common Lazarus keys. Most be be unmapped or remapped in the desktop settings.
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

Thaddy

  • Hero Member
  • *****
  • Posts: 15646
  • Censorship about opinions does not belong here.
Re: jump to method body
« Reply #7 on: August 13, 2024, 07:18:19 pm »
That is what I mean.
If I smell bad code it usually is bad code and that includes my own code.

dbannon

  • Hero Member
  • *****
  • Posts: 3071
    • tomboy-ng, a rewrite of the classic Tomboy
Re: jump to method body
« Reply #8 on: August 15, 2024, 02:52:04 am »
OK, "further research is indicated".

My system is clearly not behaving as it should. Martin, sorry, its Debian Linux running Mate DT.

But I don't think my desktop is involved. I all cases, the key combos I use do something Lazarus related. If the key strokes were being captured by eg DT then the jump to the Definition would not happen.

I have tried remapping via Lazarus's key system, in particular assigning other key combinations to the action. In my view, its the action thats not working ??

I will, time permitting, do some tests on some VMs, I will be back ...

Thanks folks for your input.

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

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10298
  • Debugger - SynEdit - and more
    • wiki
Re: jump to method body
« Reply #9 on: August 15, 2024, 11:47:59 am »
Start with an "empty" config. In your case that would mean backup and remove editoroptions.xml and codetoolsoptions.xml.
Then if you change any option, mention it when you report findings here.

All you keys will be default so you if you report pressing <whatever> it will be known.


If you can only reproduce with your current opt.xml files, then post them.

You can also document what commands the IDE actually got from your keypresses (though that does not work, if more than one editor is involved, if you go to a diff unit).
Start recording a editor-macro, and then in the marco overview select it for editing. You get to see ecFindProcedureMethod or ecFindDeclaration.



Report packages installed like
- Cody - extension to codetools, so could matter
- AnchorDocking[Dsgn]  - Should not matter, but I have seen it interfering with keys.... (though in very different ways from what you seem to have)

dbannon

  • Hero Member
  • *****
  • Posts: 3071
    • tomboy-ng, a rewrite of the classic Tomboy
Re: jump to method body
« Reply #10 on: August 15, 2024, 02:49:03 pm »
Ah, sorry Martin, I did not check back here before starting my experiments.

But I did confirm the problem was my install, U2004 Mate (my dedicated release build machine) no problems, so I proceeded to test another VM with the same OS/desktop (debian bullseye and Mate) as my real machine.

But, while doing that test, the vm went crazy requiring a reboot (yep, froze my real machine!). And, after that reboot, the problem did not show up in in any of my installs any more. I can only put that down to a desktop issue but my chance to find out exactly what was blown away by my unexpected reboot.

If I see it again ...

Thanks for your help.

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

 

TinyPortal © 2005-2018