How to find where a symbol comes from?

Answered

Imagine you have multiple wildcard imports in a source file. Or a class/interface that extends multiple interfaces of a deep hierarchy. You've just encountered a symbol and would like to know which expression in the file is responsible for bringing it into scope. Is there any way to highlight such expression in IntelliJ IDEA?

PS: I know multiple ad-hoc ways of figuring this out, but am looking for a shortcut, "single click" solution.

1
3 comments

Hello,

Could you please provide code example demonstrating the issue?

0

Sure, for example:

import a.b.c.* /* doStuff comes from here */
import x.y.z.* 
 
class MyClass
    extends BaseClass /* doOtherStuff comes from here */ {
  MyClass() {
    doStuff() // when the cursor is here, highlight 'import a.b.c.*'
    doOtherStuff() // when the cursor here, highlight the 'extends BaseClass'
  }
}
0

Currently there is no such feature. Feel free to create request on YouTrack: https://youtrack.jetbrains.com/issues/IDEA

0

Please sign in to leave a comment.