Using IntelliJ, how can I determine if a particular function is associated with Java or Scala

Take

val m = "Scala is fun" 

IntelliJ helps you figure out a lot of things you can do with this.

enter image description here

Is there a way to find out which of these functions comes from Scala and which ones come from Java?

+4
source share
2 answers

In IDEA autocompletion, methods defined by the type of the object itself are in bold, and underlined functions are added by implicit conversions and pimp-my-library (for explanation, see, for example, here or search in StackOverflow or Google).

However, for the special case of types that are defined in Java (for example, String , of type m ), you were right to distinguish Java-vs-Scala: there are bold methods that are real methods that must be defined in type m (here String ) and therefore , in Java. Although pimp-my-library is a Scala template, so normally underlined functions will be written to Scala (this is just an empirical rule, but I have not seen an exception yet).

Non-greasy functions are simply inherited.

For the volume of documentation, as a rule, the standard Java library has fairly complete documentation (it should be a specification for the method), while Scala usually changes between documents less and much less.

I was looking for how to change the fonts used for this highlight in IntelliJ 11, but I did not find much - you can change the fonts used to highlight the code, but I suspect it doesn't matter here ..

+4
source

If you have IDEA 12, you can press Ctrl-Q on any selected method in the pop-up window to view the “Quick Documentation” for this method, and not only that, you can go through the list of methods and the quick document will change according to new choices .

If you find any entries without quick help, this is a good bet; this will be the Scala method; @)

I will also check IDEA 11.

EDIT: It works for both IDEA 11 CE and Ultimate.

+2
source

All Articles