Search code examples
scalaintellij-ideacontent-assist

Intellij Content Assist for Scala popup shows subset of available methods?


The screenshot below shows the popup from Content Assist for the methods and attributes of an instance of List.. For some reason only a fraction of the methods available in the given collection class are shown. In the screenshot we see a List: but the same problem occurs for others including ListBuffer, MutableList,etc.

It is not clear what pattern is followed here. The scala.Any methods are present as well as a selected few of the collections methods ( andThen and compose). But the majority of the collections classes methods are missing.

Is there a setting and/or some workaround to mitigate /fix this?

enter image description here


Solution

  • Discovered the reason: the "instance" is actually only a reference in the code location shown. So after making it a real instance the code completion does work.

    Before:

    var children  = List[Node[T]]
    

    After:

    var children  = List[Node[T]]()
    

    Now I did actually realize the reference had not yet been initialized: but had not considered that IJ needed that to happen before being able to display methods that ALL List's provide.

    The screenshot below shows the changes : initialized the instance and popup subsequently behaving as expected.

    enter image description here