Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.3k views
in Technique[技术] by (71.8m points)

Intellij shortcut directly go to any variable Class or method

SomeClass {
   AbstractType/Interface instanceVariable = new SpecificType();

   ...

   SomeFn(){
     instanceVariable.instanceMethod();
                           | <- go to SpecificType.instanceMethod() directly
     
     instanceVariable.instanceMethod();
           | < go to SpecificType of instanceVariable directly
}

Looking for an Intellij shortcut to go to variable's Specific Class. To go to instanceVariable in a large code and want to go to its SpecificType class. It needs three commands, go to instanceVariable definition using Go to Declaration (F3), see its definition, move cursor to actual type new SpecificType();, go into it and come back where you were using (Command + [). We can also hover over "instanceVariable" definition using F2 to see what its type is, but, there is no direct shortcut to go to actual Class "SpecificType" defining this instance variable.

Same with instanceMethod(), there is "Go to Implementation" on this method of an instance (Shift+Command+I) and choose specific type whereas instance is already defined right in the class as "SpecificType" here. See method type using F2 to see which class, in this case, it will show "SpecificType" the method type belongs to, then choose the specific implementation and choose SpecificType from several drop downs.

It would be nice if there was a shortcut to directly to to exact SpecificType Class or its method instead of multiple commands.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...