Shift+F2 to find a function or subroutine automatically

Make a request or discuss new features.
Post Reply
User avatar
yereverluvinuncleber
Posts: 339
Joined: 20 Apr 2018 09:49

Shift+F2 to find a function or subroutine automatically

Post by yereverluvinuncleber »

Forgive me as always if I am asking for something that already exists somewhere with RJTextEd.

I am currently finishing one major part of my VB6 project and then dropping out on occasion to use RJTextEd when I have a bug to resolve in one of my other projects. One useful facility that the VB6 IDE provides is the ability to double-click on a function or subroutine's name

Image

then use the key combination Shift + F2, this takes you to the function or sub routine immediately. It does it regardless of the location of the routine as long as it is in a file that is open as part of the project.

Image

I have looked for something similar in RJTextEd but have not found something that works for me. When I double-click upon a function name I have the right click choice of:

Find Declaration,
Find Implementation
Find in Project.

The top two seem to do nothing when javascript is the default language, the only one that comes close to the functionality I am looking for is the "Find in Project" that does at least perform a global search for all such string occurrences.

In the VB6 IDE a simple Shift + F2 is enough to take you straight to the highlighted function. It would be extremely useful to have such a working facility in RJTextEd and the utility of the key combination would make transition between the two code editors seamless. It would also enhance RJTextEd.
Last edited by yereverluvinuncleber on 06 Feb 2023 21:17, edited 1 time in total.
"Noli pati a scelestis opprimi"... or is it "non lacessit illegitimae te carborundum"?

You can find me on Deviantart https://www.deviantart.com/yereverluvinuncleber/gallery/
User avatar
yereverluvinuncleber
Posts: 339
Joined: 20 Apr 2018 09:49

Re: REQUEST: Shift+F2 to find a function or subroutine automatically

Post by yereverluvinuncleber »

Gentle bump!
"Noli pati a scelestis opprimi"... or is it "non lacessit illegitimae te carborundum"?

You can find me on Deviantart https://www.deviantart.com/yereverluvinuncleber/gallery/
User avatar
Rickard Johansson
Site Admin
Posts: 6431
Joined: 19 Jul 2006 14:29

Re: REQUEST: Shift+F2 to find a function or subroutine automatically

Post by Rickard Johansson »

Renamed the context menu item "Find implementation" and made some improvements. "Find declaration" is only visible in Cpp and Pascal files.

C++ or Pascal
Two menu items.
* "Find declaration"
* "Find function, method or implementation"

Otherwise
One menu item.
* "Find function or method"

Done in v14.0. Thanks!
User avatar
yereverluvinuncleber
Posts: 339
Joined: 20 Apr 2018 09:49

Re: DONE: Shift+F2 to find a function or subroutine automatically

Post by yereverluvinuncleber »

Will test!
"Noli pati a scelestis opprimi"... or is it "non lacessit illegitimae te carborundum"?

You can find me on Deviantart https://www.deviantart.com/yereverluvinuncleber/gallery/
User avatar
yereverluvinuncleber
Posts: 339
Joined: 20 Apr 2018 09:49

Re: DONE: Shift+F2 to find a function or subroutine automatically

Post by yereverluvinuncleber »

Hoping to assign shift + f2 when a function call has been highlighted, wanting it to jump straight to the function itself. I am sure this used to work as I 'feel' that I used it in test and in anger but that may be just my memory.

Regardless, I cannot get it to work now.

setTooltip(); //this is the function call

Using javascript as the language filter, I was looking for :

right click - find - find implementation or method

- but it is greyed out for javascript.

Key Def.s.
Environment - Keyboard - FindImplementationAction (find the source implementation) -> SHIFT+F2

I want it to jump directly to this function implementation in my code:

//==============================================================
// this function sets the tooltips
//==============================================================
function setTooltip() {
//blah blah;
// .
// .
// .
}
//=====================
//End function
//=====================

Assuming I have it set up correctly, it seems not to be working. I believe it is because that functionality is not enabled for javascript? Just a guess.

I do need it! I would love something like this to be implementable for all languages or at least the major ones and not just C variants.

It is SO useful to have the function call in front of you in code and just being to highlight it and SHIFT+F2 to jump directly to the function or subroutine.
"Noli pati a scelestis opprimi"... or is it "non lacessit illegitimae te carborundum"?

You can find me on Deviantart https://www.deviantart.com/yereverluvinuncleber/gallery/
User avatar
Rickard Johansson
Site Admin
Posts: 6431
Joined: 19 Jul 2006 14:29

Re: DONE: Shift+F2 to find a function or subroutine automatically

Post by Rickard Johansson »

In the latest version you need to install and add a language server for it to work. I really recommend Typescript language server found in the Language Servers (LSP) thread.

Because of a bug - goto implementation doesn't work in the current version (it's fixed in the next release), but you can use goto definition.

Using a language server also improves auto completion, mouse hover results and gives you diagnostic errors, warnings...

In the next version I've added (so far):

Find References
_References.png
_References.png (6.4 KiB) Viewed 5304 times
Right click and select Find references to get a project wide list of all instances where the item under the cursor is used. Including the declaration. It can be a method, class, variable etc.

Document Symbols
_Symbols.png
_Symbols.png (12.55 KiB) Viewed 5304 times
Hierarchical list of classes, methods, properties, fields, interfaces etc. found in a file. You can switch to any file in your project without opening it.
User avatar
pjj
Posts: 2047
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

Re: DONE: Shift+F2 to find a function or subroutine automatically

Post by pjj »

Rickard Johansson wrote: 27 May 2021 13:25 Using a language server also improves auto completion, mouse hover results and gives you diagnostic errors, warnings...
Can confirm. LSP implementation is immensely and incredibly helpful!
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus
User avatar
yereverluvinuncleber
Posts: 339
Joined: 20 Apr 2018 09:49

Re: DONE: Shift+F2 to find a function or subroutine automatically

Post by yereverluvinuncleber »

I have been meaning to test, will do so.
"Noli pati a scelestis opprimi"... or is it "non lacessit illegitimae te carborundum"?

You can find me on Deviantart https://www.deviantart.com/yereverluvinuncleber/gallery/
User avatar
yereverluvinuncleber
Posts: 339
Joined: 20 Apr 2018 09:49

Re: DONE: Shift+F2 to find a function or subroutine automatically

Post by yereverluvinuncleber »

If I highlight a javascript function name in RJTextEd and do a CTRL+G to do a Goto Function, then it would be very nice indeed if the search field was automatically filled with the highlighted string.

The picture below might indicate better what I would love to see as an option.

Image

With this in place we only need to double click on a function name in our .js code and hit ctrl+g to be taken directly to the named function.

If you want me to raise this as a request in a separate post then I'll be happy to do so.
"Noli pati a scelestis opprimi"... or is it "non lacessit illegitimae te carborundum"?

You can find me on Deviantart https://www.deviantart.com/yereverluvinuncleber/gallery/
User avatar
Rickard Johansson
Site Admin
Posts: 6431
Joined: 19 Jul 2006 14:29

Re: DONE: Shift+F2 to find a function or subroutine automatically

Post by Rickard Johansson »

Done in v15.80. Thanks!
User avatar
yereverluvinuncleber
Posts: 339
Joined: 20 Apr 2018 09:49

Re: DONE: Shift+F2 to find a function or subroutine automatically

Post by yereverluvinuncleber »

Perfect. As always.
"Noli pati a scelestis opprimi"... or is it "non lacessit illegitimae te carborundum"?

You can find me on Deviantart https://www.deviantart.com/yereverluvinuncleber/gallery/
User avatar
yereverluvinuncleber
Posts: 339
Joined: 20 Apr 2018 09:49

Re: DONE: Shift+F2 to find a function or subroutine automatically

Post by yereverluvinuncleber »

Just some feedback on that feature you recently added. If the highlighted function is within the current script then it will find it and populate the search box automatically - good.

However, if that function is available to the program but NOT in the current file it cannot find it.

What would be nice is if it would automatically be able to find the target function within any one of the project's files/included scripts. Obviously, this would only kick in when a RJProj has been opened and all it's files are known to RJTexted.

By comparison. In the VB6 IDE where I still operate a lot, if SHIFT+F2 is pressed when a function name is highlighted, the editor will take you to that function whether it is in the current code module or in another as long as that is available and part of the project. The IDE automatically searches and finds the reference and takes you to it straight away regardless of where it is.

I think that RJTextEd would benefit from being able to replicate this extra bit of utility using CTRL+G. It is almost there but it just cannot find the reference if it is within another script.

When done, if I can map it to SHIFT+F12 I will be a very happy man.
"Noli pati a scelestis opprimi"... or is it "non lacessit illegitimae te carborundum"?

You can find me on Deviantart https://www.deviantart.com/yereverluvinuncleber/gallery/
Post Reply