BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Scala IDE 2.0 Adds Refactoring Support

Scala IDE 2.0 Adds Refactoring Support

This item in japanese

Just before Christmas, version 2.0 of the Scala IDE was released. The Scala IDE project, started by Miles Sabin, and later joined by Typesafe to result in a production quality Scala development environment.

The current Scala IDE 2.0 has diverged from the Scala IDE 1.x environment, with changes to the underlying Scala compiler being made to improve the suggestions and code expansions used by the IDE itself. After having gone through a series of successive betas throughout 2011, the first production release brings Scala support to Eclipse 3.6 – 3.7 is not officially supported, and has a few minor issues but can still be used.

New features include code completion (including expansion of implicits), inferred type hovering, project dependency recompilation and integration with existing tool sets like Maven. Combined with the existing Eclipse Java debugger, the IDE delivers the integrated part of the development environment, bringing the Scala language to the hands of existing Java developers.

Since the project's move to scala-ide on GitHub, the project has been forked 22 times and a small number of pull requests have been filed, demonstrating that a move to GitHub can be a good way of encouraging contributions from the community.

InfoQ caught up with Scala IDE's project leader, Iulian Dragos, and started off by asking him what the significant changes are between version 1.0 and version 2.0:

Iulian Dragos: From a user's perspective, reliability and responsiveness. We reworked all aspects of interoperation between the editor and the Scala presentation compiler, and made sure that the editor never becomes unresponsive while waiting for an action to complete. Code completion, hyperlinking, and reporting errors as you type are the highlights of this release.

We also have a new project builder that supports multi-projects with dependencies (based on the Sbt dependency tracking engine). I would say this release makes it really easy to develop Scala in projects of any size. We are using it to develop the IDE, and the Scala team is using it on the Scala compiler (more than 110 kLOC).

InfoQ: How does Scala IDE fit in with automated build tools, such as SBT or Maven?

Iulian Dragos: Both Sbt and Maven have plugins that can export an Eclipse project definition. You just import that project in an Eclipse workspace, and you're all set.

InfoQ: What kinds of refactoring and quick fixes are supported?

Iulian Dragos: Indeed, refactoring support got better in 2.0 due to Mirko Stocker's great work. We have Extract/Inline Local, Extract Method, Rename, Organize Imports. There's also a quick fix for adding a missing import, if the class is on your classpath.

InfoQ: Can you have Scala projects depending on Java projects, and vice versa, or a project with mixed Java and Scala code?

Iulian Dragos: All these combinations are supported.

InfoQ: What is the roadmap for Scala IDE in the future?

Iulian Dragos: The IDE team at Typesafe is working on a roadmap that we want to discuss with the community. So I cannot say what exactly will be there, because that will be the result of our discussions.

As in any open source project, people can come in and implement a great feature, and we'll include it. I can say that we already have some great contributions, such as 'Implicit highlight', and I know Matt Russell is working on semantic highlighting (the ability to assign different styles based on what an identifier is – class/trait/val/var, etc.). The first one is already available in the nightly builds for 2.1!

On our side, the next push will be towards a better Scala debugger (right now you can only use the Java debugger on Scala code), a clean API for other plugin developers who need to implement actions based on Scala code structure (such as test frameworks runners), and code search (for example find references). We also plan to work on a better UI to the Scala interpreter, which is one feature that has been asked by many of our users.

InfoQ: Why are there two different versions of the IDE?

Iulian Dragos: The Scala IDE uses the Scala compiler for all semantic actions. For example, errors are shown using red underlines as you type. To be consistent, we need to use the corresponding compiler behind the scenes, so if your project is using Scala 2.8, you need to use the 2.8 version of the plugin. There is no compiler switch to say "behave in 2.8 compatibility mode" to the 2.9 Scala compiler, so we need to include the 2.8 or 2.9 compiler with the Eclipse plugin.

InfoQ: Do you have a contributor agreement to allow others to submit patches to the project?

Iulian Dragos: Yes. We use the Scala license, and the same contributor agreement as the Scala project. We try to make it very easy for people to contribute, and I'm happy to see more and more people having a go at it. We have spent a lot of time cleaning up the developer documentation prior to the 2.0 release. So have a look at What to work on in the Developer Documentation and hack away!

The Scala IDE is available for immediate download. Since it comes in two different versions (each one tied to a specific Scala version) there are two update sites to install from. You can add either of these (but not both) to an existing Eclipse instance in order to install the Scala IDE:

What do you think of the new version of the Scala IDE?

Rate this Article

Adoption
Style

BT