5

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()?

2

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

9
  • Worth mentioning that e.g. on a Mac, holding down the command key results in a hyperlink appearing (if available). – Keith C Jul 31 '19 at 8:08
  • @KeithC thanks for the info, I was unaware about that. So what that hyperlink refers to? – rahul gawale Jul 31 '19 at 8:11
  • 1
    Clicking on it is a quick way to "Go to Definition". – Keith C Jul 31 '19 at 8:33
  • @rahulgawale I am not able to see ** Go to Definition** when right-clicked the method name. When click by pressing ctrl, the method does not turn into hyperlink. – वरुण Aug 1 '19 at 6:17
  • @वरुण The command button thing works only on Mac, what is the version of your VS Code? – rahul gawale Aug 1 '19 at 6:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.