LoranceChen
LoranceChen

Reputation: 2574

how to find a implicit val or def used at in idea IDE?

Ctrl + Q to find implicit conversion

Shift + Cmd + P to find the place of an implicit parameter instance

How do I find where an implicit value/def is used?

Upvotes: 13

Views: 2021

Answers (3)

Mario Galic
Mario Galic

Reputation: 48400

IntelliJ 2019.1 Scala Plugin now supports finding usages of implicits, in particular, going from the definition to the usage via Edit | Find | Find Usages:

...previously the implicits hints allowed you to see usages of implicits and go from usages to definitions, but you couldn’t do the reverse – go from definitions to usages, by invoking Find Usages. Well, now you can...

The feature worked on my machine using both the IntelliJ's internal build tool, as well as system sbt version 1.2.7 via Use sbt shell.

Upvotes: 3

Mikhail Nemenko
Mikhail Nemenko

Reputation: 141

There is at least a how key like Ctrl + Shift + Q to find implicits in scope

Upvotes: 1

Rich
Rich

Reputation: 15448

It seems to me that the standard "Show usage" command ought to list where implicit values are used. It does not currently do so (IDEA v 2018.1), but I think that is just a bug (or omission).

I have raised https://youtrack.jetbrains.com/issue/IDEA-199104 to alert JetBrains to this bug; I suggest you vote for that and subscribe to changes there.

I can't see any workaround or any other way to do this in IDEA.

Upvotes: 1

Related Questions