Forum > IDE/CodeTools
"Find declaration" option is used to do two different things
furious programming:
The Find declaration option used to make sense and was actually used to jump to the declaration, but in Lazarus 3.0 it was overcomplicated and broken. Now instead of being used to look for declarations, it can be used to look for implementations, which is absurd! You have made a huge mistake in the terms of usability, now the UX sucks!
The Jump directly to method body option should not exist at all, and instead there should be a new option called Find implementation, for which there should be a separate item in the context menu and a new item in the keyboard settings tree in the IDE settings window. This option should also be added to the mouse settings in the IDE settings window, to be able to assign it for the Ctrl+LMB shortcut (or any other shortcut).
My proposal is as follows:
* Remove this bullshit called Jump directly to method body from the Codetools→General branch in the IDE settings window.
* Add a new item in the editor context menu, called Find implementation of %s, enabled only if the identifier is the name of a routine and only if this routine has an implementation (does not apply to e.g. routines imported from a DLL).
* Add the new option called Find implementation in the Editor→Key Mappings branch and set the default Alt+Down shortcut for it.
* Add the new option called Jumps to declaration in all comboxboxes in the Editor→Mouse branch.
* Make it so that a jump to a declaration always actually jumps to a declaration, regardless of whether it is the identifier of a constant, variable, routine, etc.
* Make it so that a jump to implementation always actually jumps to the routine's implementation, never to its declaration.
* Set that a jump to an implementation made on an identifier that is not a routine name does nothing (no implementation, so no jump).Something like this is functional, intuitive and flexible. Since declaration and implementation are two completely different things, there should be two separate options for this, configurable separately and used separately, including two different keyboard shortcuts.
By the way, the Find declaration option is now broken, I reported it — https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40714
Thaddy:
ctrl-shift-downarrow, ctrl-shift-uparrow. Is that not enough?
furious programming:
Please read the topic again — and again and again, until you understand the essence of the problem.
Also check out the issue I linked to at the bottom of the first post. There's a gif that will help you understand what's going on.
In short: the Find declaration option not only works incorrectly (bug), but also may not be used for what it is intended for, i.e. searching for implementations, not declarations (broken UX design). It can be used for two separate things despite having the same caption. There should be two separate options that do what their name says.
dbannon:
Yes, I think I agree with Furious, while its possible to find just about everything you want, its not always obvious.
Thaddy, for example, is obviously confused. Ctrl-Shift-Up | Down. In the keyboard mapping, they are mapped to "Find Procedure Definition" and "Find Procedure Method". But in practice, they both do the same thing. If the cursor is somewhere in the body of a method implementation, it jumps to that declaration. If cursor is on a declaration, it jumps to the implementation. Both ~/Up and ~/Down do the same thing, toggle back and forth. I wonder why ?
Nothing to do with Furious's issue however. He is talking about jumping based on the identifier under the cursor.
Alt Arrow is described in the keyboard mapping as "Find Declaration" and its behavior is dependent on the "Jump directly to Method Body" setting, no visible link between that setting and the key mapping.
Honestly, "Jump to Declaration" and "Jump to Implementation" are both important behaviors and having them mutually exclusive does seem a bit strange.
So, I strongly support Furious's proposal (but may not necessarily insist on the strict rules he proposes).
Davo
furious programming:
As far as I'm concerned, the jump target always matters — sometimes I need to jump to the function declaration, and sometimes I need to jump straight to its body. In previous versions of Lazarus, it was always a jump to the declaration, so to jump to the function body, you had to use two keyboard shortcuts — Alt+Up to jump to the declaration, and then Shift+Ctrl+Up/Down to move to her body.
Adding the Jump directly to method body option didn't change anything in this topic, because you still have to use two keyboard shortcuts, and the difference is that the jump to declaration option actually may jump to the implementation, which is confusing.
--- Quote from: dbannon on January 23, 2024, 06:19:59 am ---Thaddy, for example, is obviously confused. Ctrl-Shift-Up | Down. In the keyboard mapping, they are mapped to "Find Procedure Definition" and "Find Procedure Method". But in practice, they both do the same thing. If the cursor is somewhere in the body of a method implementation, it jumps to that declaration. If cursor is on a declaration, it jumps to the implementation. Both ~/Up and ~/Down do the same thing, toggle back and forth. I wonder why ?
--- End quote ---
This is a mystery to me too. Why are there two options even though they do exactly the same thing? It would be best to combine both of these options into one, after all, one is enough to jump between the declaration and the implementation.
Navigation
[0] Message Index
[#] Next page