IDE Shortcut to Jump to declaration and Jump to calls

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
mdp
Enthusiast
Enthusiast
Posts: 115
Joined: Mon Apr 18, 2005 8:28 pm

IDE Shortcut to Jump to declaration and Jump to calls

Post by mdp »

One feature I regularly miss on the PB IDE¹ is a keyboard shortcut that
-- jumps to the Procedure declaration when the cursor is on a procedure call,
-- shows a list of Procedure calls when the cursor is on a Procedure declaration
...in the style of Eclipse and IntelliJ Idea.

There is a keyboard+mouse shortcut to the Procedure declaration - [Ctrl]+[DblClick] -, which is handy but may be missed as it is "only" in the manual - not in the menu, nor in the keyboard shortcuts definition list.

So, one simple addition, since the feature is already there, implemented, would be to add definable keyboard shortcuts (Preferences > General > Shortcuts) for "jump to Procedure declaration".

And a more complex addition would be to have that shortcut, when used on the declaration, produce in a pop-up a list of lines involving the procedure calls, to jump from declaration to calls.

This enables to jump to and from, in a way, from declaration to call (and call/s/ when needed).

By the way: I understand the IDE is now open-source? We can propose code ourself on GitHub - possibly also an implementation of this proposal?

--

¹Incidentally: what I missed on all other IDEs I have used, is the "Procedure (method, etc.) parameters" help in the statusbar, the way of the PB IDE. I find that feature so vital. When I use those other IDEs and their "nuclear reactor features", the weight is all for missing the PB one and its "the most vital are present, not missed!". Oh, and of course: it loads instantly; "no lengthy paperwork requested" to do your things. Just saying. Wanted to share.
Last edited by mdp on Sun Feb 06, 2022 3:41 pm, edited 1 time in total.
Axeman
User
User
Posts: 91
Joined: Mon Nov 03, 2003 5:34 am

Re: IDE Shortcut to Jump to declaration and Jump to calls

Post by Axeman »

To add to this suggestion, I'd like to see the F1 key ability to jump to any global identifier declaration (eg. the initial declaration point for global variables, arrays, linked lists, structures, procedures, etc).

Generally, I add comments to the point where a global element is declared to explain what it is for, how it is meant to be used, etc. Mostly because I have a lousy memory. Being able to quickly jump to that point in the IDE via the F1 key would be a huge time saver.
AZJIO
Addict
Addict
Posts: 2143
Joined: Sun May 14, 2017 1:48 am

Re: IDE Shortcut to Jump to declaration and Jump to calls

Post by AZJIO »

I recently started using tags

Code: Select all

;- Declare
;- Enumeration
;--> ini
;--> GUI
;--> loop
When you want to copy a part of the code to the place where you are editing the function, then just click after copying "Undo" and "Redo" to move to the code insertion point (Ctrl+Z, Ctrl+Y). Sometimes I enter a space to remember the insertion location.
BarryG
Addict
Addict
Posts: 4126
Joined: Thu Apr 18, 2019 8:17 am

Re: IDE Shortcut to Jump to declaration and Jump to calls

Post by BarryG »

Axeman wrote: Sun Feb 06, 2022 2:11 pmI add comments to the point where a global element is declared to explain what it is for
I just name everything accordingly so it's obvious what they do. For example:

Code: Select all

Global appdir$ ; Guess what this variable holds?
Procedure CenterCurrentMonthInCalendar() ; And what this does?
[etc]
I used to use short names for everything, but now that I'm older, I prefer longer descriptive names.
AZJIO
Addict
Addict
Posts: 2143
Joined: Sun May 14, 2017 1:48 am

Re: IDE Shortcut to Jump to declaration and Jump to calls

Post by AZJIO »

You can write such a program, there is an opportunity for this. The source code is passed as a variable, you open it, search for function names using a regular expression, get the position of the text, check how many line breaks before this function, respectively, get the line number, output the list of functions (the whole line) in the form of GUI+ListViewGadget, by clicking the line, send the program the Ctrl+G hotkey and insert the line number there and emulate pressing Enter, that's it.
Post Reply