Recent

Author Topic: Find procedure jump only works from declaration  (Read 8266 times)

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Find procedure jump only works from declaration
« on: January 04, 2012, 10:31:12 am »
Hi all,

Sometimes I want to see the procedure body of a procedure that is called somewhere in code. Selecting Find.. procedure jump doesn't work though, it jumps to the declaration section.

What does work is first Find declaration, then you've got the declaration, then Find..Procedure jump.

Am I making a stupid mistake or is this behaviour by design?

Thanks,
Lieutenant Hopeful
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re: Find procedure jump only works from declaration
« Reply #1 on: November 02, 2014, 02:13:55 pm »
Created this macro to solve this proplem
Code: [Select]
begin
ecFindDeclaration;
ecLineEnd;
ecFindProcedureDefinition;
end.
will drive you to the Definition of the procedure
can be applied on a selected identifier ex:
assuming you attach the macro on shift+2
Code: [Select]
procedure proc_;
procedure inside_TARGET();
...................................
.......................................
A)procedure proc_()
begin
..................
B)inside_TARGET()<---dbl click to select and press [shift+2];
................
end;
B)procedure inside_TARGET()
begin
<---your cursor will be here after
..............
............
end;
« Last Edit: November 02, 2014, 02:19:02 pm by Never »
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Find procedure jump only works from declaration
« Reply #2 on: November 02, 2014, 04:30:21 pm »
Hi all,

Sometimes I want to see the procedure body of a procedure that is called somewhere in code. Selecting Find.. procedure jump doesn't work though, it jumps to the declaration section.

What does work is first Find declaration, then you've got the declaration, then Find..Procedure jump.

Am I making a stupid mistake or is this behaviour by design?

Thanks,
Lieutenant Hopeful

My process is to use the ctrl+click and if required ctrl+down arrow to jump to the procedure implementation. I'm thinking of using a keyboard shortcut for the ctrl+click as well but haven't looked in to it any farther.

What do you mean when you say [q]find.... procedure jump[/q]? I'm looking in my menus and dialogs  and although I do see a find... menu it does not have any "procedure jump" inside the dialog or in the other menus.

Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re: Find procedure jump only works from declaration
« Reply #3 on: November 02, 2014, 04:57:01 pm »
Quote
What do you mean when you say [q]find.... procedure jump[/q]? I'm looking in my menus and dialogs  and although I do see a find... menu it does not have any "procedure jump" inside the dialog or in the other menus.
is in the context menu when right click inside the source editor second from the top
there is a sub menu click there and you will see the command
wich regardless the selection always aplies to the current procedure
the macro provided is a temporary solution until this fixed
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4676
  • I like bugs.
Re: Find procedure jump only works from declaration
« Reply #4 on: November 02, 2014, 05:24:31 pm »
Sometimes I want to see the procedure body of a procedure that is called somewhere in code. Selecting Find.. procedure jump doesn't work though, it jumps to the declaration section.
What does work is first Find declaration, then you've got the declaration, then Find..Procedure jump.

Do you mean this issue?
  http://bugs.freepascal.org/view.php?id=13245

I don't know what Mattias thinks of it. It has been open for long.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Find procedure jump only works from declaration
« Reply #5 on: November 02, 2014, 05:34:48 pm »
Oh, you mean the popup menu which has the shortcut key shift+ctrl+up. This is what I know as jump to declaration, this is what it does yes shift+ctrl+up is considered jump to declaration of the current procedure/method block not the name that cursor is on or selected, shift+ctrl+down is the jump to implementation. The current implementation of those two actions is the same allowing them to be used both interchangeably so removing one and renaming the other to switch instead of jump will be my choice.

There is no shortcut to the ctrl+click action as far as I know which is what BigChimp is looking for.

EDIT:
in "Options\Key Mappings" dialog those two are titled "find procedure definition" and "Find procedure method" which both titles missed the mark in my opinion.
« Last Edit: November 02, 2014, 05:43:04 pm by taazz »
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re: Find procedure jump only works from declaration
« Reply #6 on: November 02, 2014, 05:44:41 pm »
ctrl+click jumps to to the declaration
BigChimp  clearly states
Quote
Sometimes I want to see the procedure body of a procedure that is called somewhere in code.
After all just try the macro to see the difference
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Find procedure jump only works from declaration
« Reply #7 on: November 02, 2014, 06:16:25 pm »
ctrl+click jumps to to the declaration
BigChimp  clearly states
Quote
Sometimes I want to see the procedure body of a procedure that is called somewhere in code.
After all just try the macro to see the difference

For a good reason I suppose, eg what happens if the procedure is declared as external  ( dll/so etc) or it is declared as abstract and has no implementation? What happens if you are not interested in the current implementation but the declaration and keep on clicking until you reach some level of inheritance before jumping to the implementation? There is a bit of uncertainty of what it has to do if I had to implement it my self I would jump to the implementation when and if it is available or the declaration if it is not, it covers more use cases that way.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re: Find procedure jump only works from declaration
« Reply #8 on: November 02, 2014, 06:55:34 pm »
@taazz i agree with you
i have filled a request in mantis about it but until then i prefer to
hit shift+2
saves my self from
1 dblclick
1 rightclick
1 leftclick
1 dbliclck
1 rightclick
1 leftclick

or insted
ctrl+left click
ctrl+down

ps/ the macro is not disabling the current functionality in any way
« Last Edit: November 02, 2014, 06:57:38 pm by Never »
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Find procedure jump only works from declaration
« Reply #9 on: November 02, 2014, 07:06:27 pm »
@taazz i agree with you
i have filled a request in mantis about it but until then i prefer to
hit shift+2
saves my self from
1 dblclick
1 rightclick
1 leftclick
1 dbliclck
1 rightclick
1 leftclick

or insted
ctrl+left click
ctrl+down

ps/ the macro is not disabling the current functionality in any way
try ctrl+shift+I, Esc, ctrl+down, it should be faster than Ctrl+Click, Ctrl+Shift+Down.
I haven't looked the macro solution yet so no comments.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re: Find procedure jump only works from declaration
« Reply #10 on: November 02, 2014, 07:36:36 pm »
Sorry @taazz not willing to try anything unless is faster tha [key + key] press
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

 

TinyPortal © 2005-2018