Richard Sitze
Richard Sitze

Reputation: 8463

Why does Eclipse show incomplete Scala classes in the Outline view?

Context: Scala project with imported library such as akka-http.

IDE: Eclipse (mars) + Scala-IDE 4.3

OS: Windows

I've configured sbt to download source code related to dependent projects, so I can view/inspect libraries more fully.

When I bring up akka.http.scaladsl.server.Directive I see only the first few members of that class in the Outline view. I can see additional members in the code that are not displayed in the Outline.

Why am I not seeing the full outline?

Upvotes: 1

Views: 103

Answers (1)

Richard Sitze
Richard Sitze

Reputation: 8463

Short Answer

Right click on the project to open Properties -> Resource -> Text file encoding, and set to UTF-8.

This can also be set for the workspace properties; it's not clear to me if changing the workspace properties auto-sets existing projects, I'm guess it doesn't.

Why?

Admittedly a guess, but...

The problem seems to be associated with the combination of Scala IDE 4.3 (for Eclipse), Windows, and assumptions about source files and text encodings:

  • The Eclipse Scala-IDE 4.3 has a new Outline view, which seems to render a better representation of Scala classes by deferring to source. And it fails to do that properly when it doesn't grok the text encoding.
  • In Eclipse the default text file encoding is "Inherited from container" for the workspace. I presume existing projects inherit that setting from the workspace.
  • The Windows text file encoding (the container mentioned previously) is ISO-8859-1, or possibly something else... but not UTF-8.
  • In my problem Outline view, it turns out that the last member displayed for a class contains a unicode '⇒' (syntactically equivalent to '=>' in Scala).
  • silent boom

Upvotes: 1

Related Questions