Navigate to method definition in VSCode

I am new to VSCode.

There is an Apex class like this:

class MyClass1{
     public static void someMethod(){
          MyClass2.someMethod2();
     }
}

Other class:

MyClass2{
     public static void someMethod2(){
     }
}

I used to use Sublime Text, which shows the possible occurrence of the method in a list while hovering the mouse and we can navigate to the method by clicking appropriate option in the list.

I tried right-clicking the someMethod2() call in someMethod(), but it was not showing any option to navigate to someMethod2(). It was showing below options:

enter image description here

In VSCode one option is I can open MyClass2 and find the someMethod2().

While working on MyClass1, how can I directly navigate to someMethod2()?

Answer

There is an option for it, you can right-click on the method name and then ‘Go to Definition’. This also works for Classes and Variables.

But there is a problem, this works well for the class’s internal members but not external class’s members.

But again, this works on the External classes.

Edit: As suggested by @Keith, On a Mac, holding down the command key results in a hyperlink appearing (if available)
enter image description here

Attribution
Source : Link , Question Author : वरुण , Answer Author : Rahul Gawale

Leave a Comment