IDE: Quick jump to Macro and Label "declaration" as well

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

IDE: Quick jump to Macro and Label "declaration" as well

Post by c4s »

When the procedure name has focus and we press Ctrl + double-click on left mouse button, the selector will jump to the procedure declaration (or whatever it is called) which is quite handy.

Now I thought that it might be pretty good when it could do the same for labels and macros:

Code: Select all

Procedure TestProcedure()
EndProcedure

Macro TestMacro()
EndMacro

Label:


TestProcedure()  ; Focus and Ctrl + left double-click -> jumps to line 1

TestMacro()  ; -> should jump to line 4

Goto Label  ; -> should jump to line 7
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: IDE: Quick jump to Macro and Label "declaration" as well

Post by c4s »

I'm extending this request to really everything... So not just procedures, macros or labels, but also variables, structures, constants etc. After all the IDE should know where exactly something was defined, right?! (Obviously certain macro tricks can cause problems but the IDE is rightfully ignoring them anyway.)
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Re: IDE: Quick jump to Macro and Label "declaration" as well

Post by GPI »

[quote="c4s"]When the procedure name has focus and we press Ctrl + double-click on left mouse button, the selector will jump to the procedure declaration (or whatever it is called) which is quite handy.

Now I thought that it might be pretty good when it could do the same for labels and macros:


I don't think that a declaration of a Macro makes any sense and I think, you don't understand, what a macro is

in your Example:

Code: Select all

TestMacro()  ; -> should jump to line 4
is complete wrong.
A Macro work like search and replace. Search in the Quellcode "TestMacro()" and replace it with the Text between Macro and EndMacro. There is no jump. And thats why a declaration doesn't make sence.

About Labels: You don't need to declare labels, even when they used before the definition. Labels are only a Adress and with "?label" the compiler has every information which he need in there. Also in your Example: Goto will work! But important: You can't goto or gosub outside or inside a procedure! And in 99,99% of all cases: DON'T USE GOTO AND GOSUB! Use Procedures instead.
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: IDE: Quick jump to Macro and Label "declaration" as well

Post by c4s »

@GPI
Sorry, but you really didn't understand what I mean. Maybe I've mixed-up the words "declaration" and "definition", but if you know the feature I'm talking about in the example you should know what I've actually meant.

So let me put it this way: Double-click on a procedure's name, while the [Ctrl] key is pressed, jumps to the definition of the procedure. I think we all agree that this is a cool feature, right? I simply want it to be expanded on macros, structures etc. as well. (Granted that it makes less sense for variables or labels but why not implement it for them too for the sake of completeness?)
GPI wrote:in your Example:

Code: Select all

TestMacro()  ; -> should jump to line 4
is complete wrong.
My example is correct, trust me: [Ctrl] key plus double-click on "TestMacro" should jump to line 4 of the IDE's source code file (not during runtime :shock: ).
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Re: IDE: Quick jump to Macro and Label "declaration" as well

Post by GPI »

Sorry, i missunderstod you. I thougt that you want to "declare" a Macro, so you can use it bevor you define the macro. You want the IDE, that on a doubleclick on Macro/Label it should set the cursor to the definition of the Label/macro.
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: IDE: Quick jump to Macro and Label "declaration" as well

Post by c4s »

GPI wrote:Sorry, i missunderstod you.
No problem.
GPI wrote:I thougt that you want to "declare" a Macro, so you can use it bevor you define the macro.
Well, actually I've requested that in another thread. Unfortunately it seems like macros are too wayward for that. But I still think that "declare" for arrays, lists, variables or structures makes sense, because in the end I want to structure my code the way I want and not how the compiler needs it.
GPI wrote:You want the IDE, that on a doubleclick on Macro/Label it should set the cursor to the definition of the Label/macro.
Yes, that's correct.
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: IDE: Quick jump to Macro and Label "declaration" as well

Post by davido »

GPI wrote: But I still think that "declare" for arrays, lists, variables or structures makes sense, because in the end I want to structure my code the way I want and not how the compiler needs it.
+1

@GPI,
I've always wondered why the IDE cannot automatically place a declare list for us near the head of the code. It already does something similar on the 'Procedures' Panel?
Perhaps I'm missing the obvious. :)
DE AA EB
HanPBF
Enthusiast
Enthusiast
Posts: 570
Joined: Fri Feb 19, 2010 3:42 am

Re: IDE: Quick jump to Macro and Label "declaration" as well

Post by HanPBF »

Very great idea upgrading the IDE!

+2 voting points from my 10 a week :wink:
BarryG
Addict
Addict
Posts: 4118
Joined: Thu Apr 18, 2019 8:17 am

Re: IDE: Quick jump to Macro and Label "declaration" as well

Post by BarryG »

+1 for macros. The procedure browser lets us jump directly to macros, so the functionality is there, meaning Ctrl+DoubleClick could do it for them, too.
Post Reply