How to contribute to IntelliJ Scala plugin

It may well be that you haven’t considered contributing to any open source project, let alone the IntelliJ Scala plugin. However, if you use IntelliJ IDEA to write Scala code, it’s actually a very reasonable thing to do. Here’s how you can benefit from contributing to the plugin code base.

There’s a common misconception about attracting contributors where the process is viewed as “a way to get developers for free.” Nothing could be further from the truth, at least in our case. While the Scala plugin code is open source, there are currently 10 people in the Scala team at JetBrains working on the project full-time. Believe me, we can implement features and fix bugs on our own just fine, and that’s the straightforward way to do that. We’re making additional efforts by creating documentations, publishing tasks, recording videos and doing consulting in order to get to know people and to establish relationship with the Scala community.

Another prejudice that prevents many people from contributing is a notion that “programming an IDE is hard.” I admit that there’s an element of truth in that one, because both IDEA and the Scala plugin code bases are somewhat complex. However, on the one hand, the complexity of different tasks varies greatly, and on the other hand, this provides a great opportunity to learn something new about your tools of the trade. Make no mistake, writing IDE code can be both educational and entertaining!

If you want to contribute, where to start? First I recommend that you watch the video recording of our recent ScalaSphere presentation, Inside IntelliJ Scala plugin. It shows you how to configure the development environment and gradually introduces you to the inner workings of IntelliJ IDEA and the Scala plugin:

The slides (PDF) and the source code are also available.

You can select a task by searching for Up For Grabs tickets in our issue tracker. But don’t feel restricted by that list, as in principle, you are welcome to choose any existing ticket or any task you can imagine.

If you choose to implement one of the 100+ envisioned collection inspections, feel free to check the dedicated article for more info on that endeavor.

Here’s a fuller list of resources you can rely on:

  1. IntelliJ Scala plugin project on Github
    1. Setup instructions in Readme
    2. ScalaSphere branch with examples.
  2. IntelliJ Platform SDK Documentation
    1. Architecture Reference Guide part
    2. Custom Language Support part
  3. Viewing PSI Structure help topic
  4. IntelliJ IDEA project on GitHub (the platform API docs are fairly good)
  5. The Scala Language Specification (PDF)

If you have any questions, you can ask them:

Please don’t hesitate to ask any questions, even “obvious” or, on the contrary, “too hard” and “rhetorical” ones. We actually encourage you to ask questions and to get in touch.

Although the process is a goal in itself, if you happen to implement some feature or fix a bug along the way, just create a pull request or send us a patch, as usual. We also send cookies some small but cool stuff to active contributors, just for the fun of it.

Contribute with pleasure!

Sincerely,

The IntelliJ Scala Team

Posted in Uncategorized | Tagged , , , | 12 Comments

Scala Plugin EAP Speeds Up Coding Assistance

Because of its nature, Scala code is really difficult to edit without proper coding assistance. And sometimes said assistance is too slow which makes it not that useful. That’s why we never stop improving our Scala plugin performance. This time we’ve reduced the time needed to provide coding assistance within methods with a defined return type. As a result, code completion and inspections in our latest EAP build now work much faster.

Before:

SpeedBefore2-1

After (see how much faster it is, the animation is 100% real time snapshot):

SpeedAfter-1

To give the new EAP build a try, download it from the EAP page, or if you use the EAP plugin upgrade channel, upgrade from the IDE.

Develop with Pleasure!

Posted in EAP, New Features | Tagged , , , | 6 Comments

IntelliJ API to Build Scala Macros Support

Today we’ve released a new Scala plugin EAP build. With this build, we’re happy to introduce an API that extends the IDE coding assistance to custom Scala macros.

A macro is executed at compile-time and modifies the AST of your code: e.g. it can extend the class or its companion object with new methods or other code represented by the AST returned by the macro. Since IntelliJ IDEA’s coding assistance is based on static code analysis, the IDE is not aware of AST changes, and can’t provide appropriate code completion and inspections for the generated code.

Since macros are heavily used in some projects and libraries, we’ve added a special API to the platform that lets build IntelliJ plugins supporting particular macros. Using this API, we earlier added support for Monocle, and now Simulacrum:

v15_scala_macros

Now, everyone can use this API to make their macros more friendly to their favorite IDE. To do that, you have to implement SyntheticMembersInjector, and register it in the plugin.xml file:

The Monocle and Simulacrum implementations will help you understand how to use the API. To help you with setting up a project, we’ve prepared a skeleton. You’re welcome to fork it, and add your implementation.

Once you’ve built a working plugin, it can be installed to the IDE via SettingsPluginsInstall plugin from disk…. If you want to share your plugin with other IntelliJ IDEA users, feel free to upload it to our plugin repository.

We’re eager to hear your feedback on the API. Feel free to share it either here in comments, on our discussion forum, or in the issue tracker.

In case you’d like to have particular macros supported by the Scala plugin, send us pull requests.

Develop with Pleasure!

Posted in EAP, New Features | Tagged , , , , , | 7 Comments

IntelliJ IDEA 15 EAP Adds Postfix Code Completion for Scala

For Java, in addition to the regular completion, IntelliJ IDEA provides so-called Postfix completion: it lets you modify a previously entered expression by adding a “postfix” to it and pressing Tab. This way you can transform your code without unnecessary backward caret jumps.

Many users’ve asked us to support this feature for Scala as well. You asked, we did it:

hachiko

When a transformation can be applied to several expressions, the IDE will offer you a choice:

Postfix1

Postfix completion suggestions are included in the common completion list, and if you want to see only postfix completion applicable in the context, press Ctrl + J (Cmd + J for OS X):

Postfix3

To see the full list of postfix completion templates, go to Settings → Editor → General → Postfix Completion:

Postfix2

Remember, we welcome your feedback on our discussion forum and your bug reports in the issue tracker.

Develop with Pleasure!

Posted in EAP, New Features | Tagged , , | 3 Comments

Testing Improvements

We’ve recently improved the support for Scala tests in IntelliJ IDEA 15 EAP a bit. Read on to find out more details.

Statically computed expressions in scalaTest/specs2/uTest2 test names are now supported, which means that along with string constants you can use constructions like immutable string variables, concatenation, substring, stripSuffix, stripPrefix, toLowerCase, replace, or trim.

TestNamesNew

scalaTest/specs2/uTest2 tests and their hierarchy is displayed in the File Structure view when you click Show scala tests.

TestStructNew

Don’t forget that your feedback is always welcome in our discussion forum and issue tracker.

Develop with Pleasure!

Posted in EAP, New Features | Tagged , , | 6 Comments

Debugging Lambdas and Macro Expansion Extractor

We have released a new EAP version of the Scala plugin for IntelliJ IDEA 15 EAP. Here is a couple of new features we have added:

Debugging: stopping at Lambda Expressions

When you add a breakpoint to a line that contains a lambda expression, the IDE offers you several options where it should stop. Choose any lambda expression if there are several of them, or stop at the whole line. You can use the Run to cursor function on a lambda expression as well.

ScalaLambdas

You can use Ctrl+F8 to add a breakpoint. Then the lambda expression that the cursor is placed on will be selected in the list. Pressing Ctrl+F8 again will complete creating a breakpoint on the selected lambda.

Macro Expansion Extractor

Sometimes it’s useful to extract a macro expansion in the place where you are using it, which can help you debug the macro. Before using this, compile the code with “-Ymacro-debug-lite”.

MEE1

Press Ctrl+Alt+Shift+Z with the cursor placed on the macro.

MEE2

If the cursor is not on a particular macro, all macros in your file will be expanded.

Please, share your feedback in our discussion forums and issue tracker.

Develop with Pleasure!

Posted in EAP, New Features | Tagged , , | 7 Comments

Inline Refactoring for Type Aliases and Kind Projector Support

Scala Plugin 1.7 for IntelliJ IDEA 15 EAP brings you a number of new features and improvements, among which we’d like to highlight these two:

Inline refactoring for type aliases

Invoked just as any other inline refactoring, by placing the caret on an alias you want to inline and pressing Ctrl+Alt+N.
ScalaGif
For now this refactoring is only available for non-parameterized types and for aliases that are used inside of the same class.

Kind projector support

Kind Projector is a Scala compiler plugin that provides an easy way to create type lambdas. Scala 1.7 plugin includes inspection that suggests to rewrite existing lambdas using the Kind Projector function syntax.
kindprojector
You can use the settings under Settings | Editor | Code Style to select whether you want to denote lambdas with the Lambda keyword, or the λ symbol.
Feel free to share your feedback in our discussion forums and issue tracker.

Develop with Pleasure!

Posted in EAP, New Features | Tagged , , | 2 Comments

Try Experimental SAM in Scala Plugin 1.7 for IntelliJ IDEA 15 EAP

If you being in the forefront of it all, and all includes the latest language and IDE features, you’re welcome to download IntelliJ IDEA 15 EAP, a very early preview of what the next big Java IDE is going to be like. Among other things, it brings you an update to the Scala plugin 1.7 we released yesterday.

One of the 1.7 highlights is the support for experimental single abstract method types (SAM) added in Scala 2.11:

scala_sam

This is the first version of the plugin available exclusively for IntelliJ IDEA 15 EAP. More new features are coming soon, so stay tuned. If you have feedback to share, please do so in our discussion forum and issue tracker.

Develop with Pleasure!

Posted in New Features | Tagged | 3 Comments

Scala 1.5 EAP: Coding Assistance for Interpolated Strings, New Inspections and Better SBT Support

If you’re using the EAP update channel, you might’ve noticed a new version of the  Scala plugin available. In addition to a bunch of bugfixes inside the new update you’ll also find a few nice new features.

Coding assistance for interpolated strings

Interpolated strings is a great feature of the Scala language. Better coding assistance for writing those interpolated strings is a new feature of IntelliJ IDEA. Now it’s possible to quickly turn a string to an interpolated string simply by adding a variable reference. Notice  that the IDE will take care of adding brackets:

scala_interpolated_string_completion

We hope this additional coding assistance will save you some time.

New inspections for Scala Collections

Inspections help you spot potential problems in your code and find the code that smells. This is why we never stop adding new inspections: this time we’ve added several more that will ensure you treat Scala Collections properly:

scala_collections_inspections

SBT project auto-import

The SBT project auto-import (when enabled) has been triggered by any change in your SBT files, even if you just pressed a single keystroke. In our latest update we’ve changed it so the auto-import is now triggered only when your changes are physically saved (usually on frame deactivation).

We hope you’ll find all these changes useful. Please share your feedback on our discussion forum and submit found issues directly to the tracker.

To give this EAP update a try, just go to Settings (Preferences for OS X) → Languages & Frameworks → Scala → Updates → Plugin update channel, switch the EAP channel, and update the plugin.

 Develop with Pleasure!

Posted in EAP, New Features | Tagged , | 6 Comments

What to Check Out in Scala Plugin 1.4.x for IntelliJ IDEA 14 & 14.1

If you’ve already upgraded to IntelliJ IDEA 14.1 (released just a few days ago), you might’ve noticed (in addition to all of its awesome new features), a new Scala plugin update: v1.4.15.

The update brings you quite a few improvements for the Play framework support: fixed problems with running of the applications, and better yet, JavaScript injection to Play templates. 1.4.15 is the first of the planned series of Scala plugin updates that will be available exclusively for IntelliJ IDEA 14.1, because at this moment IntelliJ IDEA 14 only receives bug fixes, whereas the new feature development is entirely focused on 14.1. This also means more new features and improvements are on the way for it, so getting the 14.1 is a good idea (if you haven’t done this already.)

Now that I’ve already got your attention, I’d also like to review what’s exactly new in this Scala plugin version (in case you haven’t followed the EAP news.)

Continue reading

Posted in Uncategorized | Tagged , , , , | 38 Comments