Jumping to macro definition (like procedures)

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Jumping to macro definition (like procedures)

Post by PB »

I just held down the Control key and double-clicked a macro and the source
didn't jump to it. (Initially, I thought I was double-clicking a procedure name).
Could this functionality please be added for a future release? Thanks.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: Jumping to macro definition (like procedures)

Post by c4s »

PB wrote:I just held down the Control key and double-clicked a macro and the source
didn't jump to it. (Initially, I thought I was double-clicking a procedure name).
Could this functionality please be added for a future release? Thanks.
+1

This "jump to definition" feature is very handy - I use it a lot! The only downside is that it doesn't work for macros. Any updates on this feature request?


Exactly 5 years have passed since the initial post. I swear this is a coincidence! ;)
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: Jumping to macro definition (like procedures)

Post by Tenaja »

c4s wrote:This "jump to definition" feature is very handy - I use it a lot! The only downside is that it doesn't work for macros. Any updates on this feature request?
+1
User avatar
luis
Addict
Addict
Posts: 3893
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: Jumping to macro definition (like procedures)

Post by luis »

I don't know if this is gonna happen.

First of all, a procedure it's an identifier always followed by (), a macro doesn't always need that so it's harder to identify it in the source for the editor, which it's not the compiler.

Also a macro can be generated by other macros, so when you select the macro invocation there is no place where jump to because the macro it's not plainly declared, it's generated.

Also a macro can be in a resident while a proc can't (but can be in a dll).

Example

Code: Select all

  
Macro colon
 :
EndMacro

Macro buildmacro
 colon#Macro test : Debug "hello world" colon#EndMacro
EndMacro

buildmacro

test ; nowhere to jump 

On second thought the same can be said for procs generated by macros too, and so this can already happening.
Maybe I'm wrong then, if accepting these limitations is ok. Just thinking out loud...ehm....
"Have you tried turning it off and on again ?"
A little PureBasic review
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: Jumping to macro definition (like procedures)

Post by c4s »

@luis
The Procedure Browser tool already allows jumping to the definition of procedures and macros. In your example "buildmacro" and "colon" are listed, so I'd suggest that only those two would be available for the jump.
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
User avatar
luis
Addict
Addict
Posts: 3893
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: Jumping to macro definition (like procedures)

Post by luis »

c4s wrote:@luis
The Procedure Browser tool already allows jumping to the definition of procedures and macros.
Oh, I completely forgot about that, I'm sorry. So yes, it's already doing what requested, just somewhere else.

And yes, only those two would be "available" for the jump.
That was my point as in "it can't work for every macro, since you can actually generate them in code".
But anyhow was a moot point since the same already happen for procedures built through macros.
Please forgive my intrusion :P
"Have you tried turning it off and on again ?"
A little PureBasic review
Post Reply