如何使用 Intellij Idea 查看参数化 Scala 方法的实际 return 类型?

How see actual return type on parametrized scala method with Intellij Idea?

考虑一个代码:

//here Map is scala.collection.immutable.Map
val myMap = Map.empty[String, Int]
//getting value can be anywhere, not at next line
val value = myMap.get("myKey")

当在 value 上的 Intellij Idea 中按 ctrl + q 时,我看到了

Pattern: value: Option[Int]

但是当我将光标放在 get 函数上时,它会弹出消息:

scala.collection.MapLike
def get(key: A): Option[B]

例如我只需要在方法上按一些东西,就能看到实际的参数化,而不是写 val some = methodCall 和检查 val 常量。

有没有办法在 Intellij Idea 中查看具体类型而不是泛型参数化的 Scala?

在 OSX 中,如果我在将鼠标悬停在您的方法上时按住 Command,我会看到

scala.collection.MapLike
public def get(key: String): Option[Int]

如果您使用的是 Windows/Linux,那么我相信它与 Command 的等效键相同。