Code Recommenders 2.2: Intelligent Constructor and Subtype completion for Eclipse Mars

Every year, the Eclipse community works in concert for the annual “release train”. And just like in previous years, the train arrived right on time. Since June 24th, Eclipse Mars is out – and with it Code Recommenders 2.2.0.

What’s New?

Code Recommenders 2.2 includes not one, but two new code completion engines: constructor completion and subtypes completion. Together, the two completion engines address one of the more annoying quirks of content assist in Eclipse: The looong list of irrelevant constructor proposals you get whenever you want to create a new instance of that type. Let’s look at them in detail.

In the above example, most of the types that content assist proposes aren’t even subtypes of List!

Let’s have a look at the two engines one by one to get a better understanding of how they jointly help to address this issue.

Constructor Completion

Code Recommenders’ new constructor completion recommends which of the available constructors you are most likely to use based on what others have used before when creating an instance of the given type:

Please note: At the moment, Code Recommenders ships with constructor-recommendation models for the Java Runtime Environment only, but expect models for other libraries to become available in the future.

Subtypes Completion

While constructor completion relies on knowledge gleaned from the code of others, subtypes completion makes use of what is already in your workspace; it analyzes your project’s classpath in the background and maintains an index to quickly answer queries about the possible subtypes of List, for example. These subtypes are then ranked higher in the list of recommendations and marked with a star:

Maintaining the index requires some CPU cycles. Subtypes completion thus needs to be explicitly enabled by you. To this effect, Code Recommenders will automatically ask you during content assist:

The “Enable Subtypes Completion?” completion tip asking the user whether to enable Code Recommenders‘ subtypes completion

But if you are really impatient, you can immediately enable subtypes completion on the Code Recommenders > Completions preference page.

Improved Responsiveness

With a bit of help from the UI Responsiveness Monitoring Tool and the Automated Error Reporting, both of which are new in Eclipse Mars, we improved performance and responsiveness of Code Recommenders in several ways:

  • Code Recommenders now starts in a background thread. This means no more UI freezes the first time you trigger content assist after starting Eclipse.
  • Subwords completion performance has been improved significantly, even when dealing with thousands of type or constructor proposals.

More Recommendation Models

Year after year, the Eclipse community produces many useful libraries and frameworks. In the past few weeks, our number-crunching server was hard at work catching up with the community, ultimately producing recommendation models for 4,576 libraries. Compared with the last year’s Luna release, there are more than 800 additions, be they for entirely new libraries or major new versions of established ones such as EGit, which Code Recommenders now supports in versions 2.x, 3.x, and 4.x.

The Code Recommenders Model Repositories view showing 4.576 models, with three different major versions of EGit

Enabled by Default

Last but not least, Code Recommenders is now enabled by default. Whether you download an Eclipse package that has Code Recommenders pre-installed, like the Eclipse IDE for Java EE Developersfor Java Developers, for RCP and RAP Developers, or for Eclipse Committers, or whether you install Code Recommenders yourself from the Eclipse Marketplace, you will not need to activate it anymore.

This means it’s gotten even easier to get started with Eclipse Code Recommenders. All you need to do is grab Eclipse Mars from a download mirror near you or install Code Recommenders 2.2 from the Eclipse Marketplace.

Download Eclipse Mars Install Code Recommenders

Add new comment