(Scala) Implicit Parameters Menu Item in IntelliJ IDEA. How to use it ? What is it good for?

StackOverflow https://stackoverflow.com/questions/22659828

  •  21-06-2023
  •  | 
  •  

Вопрос

There is an implicit parameter menu item in IntelliJ as shown below.

What is it good for ?

How can I use it ?

I tried to press SHIFT-COMMAND-P on parts of the code where implicits are used and nothing happened.

enter image description here

Это было полезно?

Решение

Using Intellij 13.1:

I didn't notice this feature before (thanks :)), but I've just tested it and I can confirm that Implicit Parameters reveals the implicit parameters used in a method call while the cursor is placed onto it.

enter image description here

In my sample, I put the cursor on the outermost wrapping method call, my Ok call, and it shows it needs (and uses) an implicit parameter: a Writeable[JSValue].

Also, when the cursor is placed on a nested method call, like in the following Json.json call, a quick use of Implicit parameters feature makes IntelliJ suggest you which method to scan for implicit calls up to the outermost wrapping method (Ok in this case):

enter image description here

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top