Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala Eclipse Autocomplete Broken?

I'm trying to get autocomplete working in eclipse for scala development. I'm trying to reference a java class from a Scala class, and the autocomplete feature never finds it.

for example take this scala class:

object Main {
 def main(args: Array[String]) {
  val btn = new JButton
 }
}

When I hit ctrl+space at the end of typing JButton autocomplete finds "Arr", "asof", "case", "catch", "def" etc... but no classes.

in Window->Preferences->Java->Editor->Content Assist->Advanced I have selected under "Default Proposal Kinds":

Java Proposals, Java Type Proposals, SWT Template Proposals and Template Proposals.

I'm using the Scala 2.8.0-final plugin under Eclipse 3.5.2, in Windows 7

Has anyone else encountered this problem? Any solutions?

like image 722
Patrick Arnesen Avatar asked Aug 25 '10 16:08

Patrick Arnesen


People also ask

Does Eclipse have autocomplete?

Microsoft Visual Studio has a famous feature called IntelliSense. Eclipse has a similar built in feature called "Code Assist" which I find very useful. Code Assist is triggered automatically in a number of situations (for example, typing the "." after a variable name or class name).

Does Scala work on Eclipse?

Scala IDE. The Scala IDE for Eclipse is centered around seamless integration with the Eclipse Java tools, providing many of the features Eclipse users have come to expect including, Support for mixed ...


1 Answers

That type of auto-completion is not yet supported by the Scala plug-in. You can get a similar result by waiting for the compile error to appear, pressing Ctrl-1, and selecting the quick fix to automatically import the type.

See the "Quick fix imports" section in this "New and noteworthy" post.


Update September 2011:

Luc Bourlier has committed an improvement for this to give autocompletion for types on the classpath. It will be in the next beta (2.0.0-beta11), or grab a nightly build.

like image 51
Matt R Avatar answered Sep 23 '22 14:09

Matt R