Update on R Language Support in IntelliJ-based IDEs
Since its first days as a company, JetBrains has relentlessly worked to make professional software development a more productive and enjoyable experience. This mission started 20 years ago with a single tool that helped refactor Java code and which later became a full-fledged IDE. Today JetBrains offers a dozen IDEs that replicate the enjoyable experience of developing with IntelliJ across multiple programming languages. In this post, we’d like to give you an update on one of those languages: the R language.
Support for the R language has been available for IntelliJ IDEA for quite a while. It was possible thanks to the help of Holger Brandl, who originally developed the plugin and then maintained it over many years. And relatively recently, JetBrains started to contribute to the plugin. JetBrains has helped re-implement some elements of the plugin and has significantly improved the plugin’s user experience by providing additional console and graphics integration, a working debugger, Rmarkdown support, and advanced coding assistance.
The plugin’s source code has remained open source, and the plugin itself is now compatible not only with IntelliJ IDEA but also with the entire family of the IntelliJ-platform, which means that it is now also available in PyCharm, DataGrip and other IDEs. Below you can find more details about the recent major improvements.
In case you don’t have time to read the entire post, here’s a quick glimpse of how it now feels to edit R code using the plugin:
As you can see, writing and reading R code using the plugin is now a rather pleasant experience.
The plugin now supports Extract and Inline refactorings. Notice that it is capable of automatically detecting code duplicates and replacing them during refactoring:
Parameter hints are another nice productivity improvement. These hints are special inlays in the editor that display the names of the function arguments which makes the code easier to read:
In cases where that the editor doesn’t show a hint (e.g. by default hints only appear for literal argument values) or the arguments haven’t yet been specified, you can invoke the Parameter info action to see the available signatures of the function and the expected argument name and type based on the caret position:
Another great feature highlights errors, such as unresolved functions, for you in real time. This reduces the time you spend manually searching for errors after a program has failed in runtime:
In cases where an error can be fixed with the help of the IDE, you’ll see a light bulb indicating that you can press Alt+Enter and invoke a quick-fix for it. Here’s just one example:
In addition to helping you write or read the code, the IDE also helps you navigate the codebase. For example, the IDE can take you to usages (Show Usages or Find Usages) or declarations (Go to Declaration) of variables and functions:
Because the IDE keeps track of all usages of every symbol in the project, it can help you, for example, rename any symbol with just one click and without any additional dialogs:
When it comes to reading the code, the IDE offers Semantic Highlighting. This feature uses a distinct color for every symbol, which makes it much easier to distinguish those symbols in the code:
As you can see, the IDE’s editor is very intelligent and tries to help you, not just when you’re writing code but also when you’re reading and navigating through it. And of course, that’s not all. The IDE’s R plugin also offers many other important features, including:
- Various types of code completion, for example, basic completion for symbols and file paths (Basic Completion) and hippie completion (Cyclic Expand Word)
- Variable Viewer
- Support for RMarkdown
- The R Console
- The Graphics tool window
- A viewer for data sets
- A package manager
While it’s just a plugin, it offers the experience of a full-fledged IDE, providing an ergonomic environment for productive work with R code:
And this doesn’t even include all the great features the IntelliJ platform offers in addition to R code support, such as superior support for Git, the built-in terminal, tools for accessing databases, and many more. The fact that R language support is a plugin makes it possible for you to use it with any JetBrains IDE you choose, whether it’s PyCharm, IntelliJ IDEA, DataGrip or some other IDE, either open-source or commercial.
Finally, the plugin can be downloaded right from inside the IDE. Just download the IDE of your choice, open the Settings | Plugins, type R in the Marketplace tab, click R and then Install:
If you’d like to check out all the details about the plugin, or even share it with a friend of yours, you can find them on the plugin’s page in the plugin repository.
In conclusion, you can rest assured that the JetBrains team is actively working on this plugin and a stream of new features is on its way. Whenever you come across an inconvenience, whether it’s a bug or a missing feature, make sure to let us know about it by submitting a post to our issue tracker, which we are always keeping an eye on.
The Drive to Develop
The JetBrains Team