IntelliJ IDEA FRC Plugin Update Released for 2022

Just in time for Kickoff 2022, I’ve released new version 2.0.0 of the (unofficial) FRC Plugin for IntelliJ IDEA . Versions 2021.2.x and 2021.3.x of IntelliJ IDEA are supported for all editions (Community, Education, and Ultimate). Starting this year, I plan to increase the major version number each build season for better clarity of when the plugin supports the next build season. Hence the 2.0 versioning after several years of v1.x (and 0.x) releases.

Installation

You can install by going to File | Settings | Plugins, select the “Marketplace” tab, and then search for “FRC”. Select the “FRC” plugin and click the Install button. After it completes, you may need to restart IntelliJ IDEA.

To upgrade, go the File | Settings | Plugins, select the “Installed” tab, then search either for “FRC” or for “/outdated”. Click the “Update” button. After it completes, you may need to restart IntelliJ IDEA.

What’s New

New Project Wizard

image Kotlin Project Templates image

A big add this release is Kotlin Project Templates in the New Project Wizard. All project based templates can now be created in Java or Kotlin. As a disclaimer, Kotlin is not officially supported by FRC/WPI. But many teams (including mine) have used it the past few years. That said, just know as an unofficial language, you may not be able to get assistance at events if you have issues.

None of the examples have Kotlin templates, just the Project Templates ones. There are just too many examples to port over to Kotlin. That said, I will look at porting over one or two representative examples and making them available in a future version of the plugin. Let me know if there are particular ones you would like to see port to Kotlin.

Note that all the (Java) templates, both Projects and Examples, are direct ports from the WPI Lib VS Code plugin.

Kotlin Support for Projects

In addition to Kotlin templates, you can add Kotlin support to a project. So even if you create the project as a Java project, you can have Kotlin support. That way you can do some work in Kotlin as a way to introduce it to yourself and your students. Writing tests, or some simple utility functions in Kotlin is a great way to get started, and to fall in love with Kotlin :heart_eyes_cat:

Romi Templates

Although added last year, it’s worth noting that Romi templates are available. My team had great success using Romi robots for teaching remotely. And we continued to use them this year as it allows for each student to have their own robot when teaching programming, specifically the WPI Lib framework. And the other subteams can work on the “real” robot while the software team learns on Romi robots.

Error report submitter

On the less glamorous side of things, I implemented a custom Error Report Submitter. If an error or exception occurs in the FRC Plugin, you can submit a report of the problem to me with just a couple of button clicks, starting with the flashing red explanation point in the lower right corner. That icon indicates an error occurred somewhere in the IDE. If it is the FRC plugin (or any other plugin that has a Error Report Submitter), there is an option to send a report via a button click. I do kindly ask you to submit reports should an issue occur so I can resolve them. As a one person shop, my testing may not catch everything and all possible use cases. Thanks!

Previous features

As a reminder, here are some of the other features the plugin provides.

RioLog Console Tool Window

While the Gradle “riolog” task can be used to view the riolog output in the Gradle build window, the FRC Plugin provides a dedicated RioLog Console Tool Window which allows for pausing, restarting, search, and clearing of the output, either on demand or automatically upon robot restart. It also provides native supports the awesome Grep Console plugin providing you with color syntax highlighting, output folding – so you can have those verbose debug statements folded out of view until you need them – as well as the ability to filter out lines. (FYI, I have no affiliation with the free Grep Console plugin. I just think its a great plugin and therefore wanted to provide support for it, if for no other reason then for my own use :slight_smile: )

Command Based Robot Templates

There are several command based robot class templates to make coding easier. For example, when creating a command, you can select required subsystems:
image

The resultant created command will have the appropriate call to addRequirements:

In Commands written in Kotlin as well:

Run/Debug Configurations

Projects created via the new project wizard have run debug configurations generated for them. This not only makes building and deploying easier – and accessible from all the familiar run/debug keyboard shortcuts – but it makes debugging easier. No more digging through the docs or Chief Delphi to refresh your memory on how to configure things to attach your Robot to the debugger. Simply run the “Build & Deploy Robot for Debugging” configuration, then use one of the “Debug Robot” debugger tasks (depending on how you are connected to the robot) to attach IntelliJ IDEA’s debugger.

image

You can also access the gradle based run/debug configurations from the Gradle tool window:

image

Automatic notifications of WPILib Updates Available

When a WPILib update is available, the FRC Plugin will provide a notification to you. And with one click, your gradle build file will be updated to the new version, and your project re-imported (i.e. sync’ed).
image

The check for update can also be run manually from the Tool menu:
image

Feedback Welcome

As always, I sincerely appreciate any feedback you have. Please let me know if you are finding the plugin worthwhile by commenting below. Also please feel free to open any feature requests, or report any issue via the Project’s Issue Tracker . I have a few more minor tweaks I hope to get done and pushed out next week before my Software Mentoring duties become my main focus for Q1.

Good luck to all the teams this year. I hope this plugin helps you to develop your robot with pleasure.

10 Likes

Huge thank you for continuing development of this plugin. I’ve been using it since before GradleRIO was part of wpilib and it’s been awesome seeing it continue

1 Like

Very nice work you’re doing. Keep it up!

1 Like

@Ryan_Blue and @Oblarg Thanks for the feedback. It’s sincerely appreciated. The only feedback I typical get is the download count. So it’s nice to get some direct feedback, and to hear folks are finding the plugin useful.

1 Like

Just a heads up that I’ve released v2.1.0 of the FRC Plugin for IntelliJ IDEA. It contains some additional Kotlin based Command Based robot new class templates, along with a fix for an intermittent Plugin API based exception.

2 Likes

For some reason we are seeing it where the FRC plugin does not automatically detect that a project is an FRC project and does not automatically create all of the handy run configurations. Any ideas with out more information on why this might happen or how to force the FRC plugin to create all of these? For now we are just copy and pasting them from projects that did pick them up.

(The FRC plugin tab does still show up at the bottom of these projects.)

The run configurations are created when you create the project via the New Project Wizard in IntelliJ IDEA. I had not thought about creating them when you open a project in IntelliJ IDEA and they do not exist, at least on first open. (To account for the use case of a project being created via VSCode or such). That’d be a cool feature. I should have thought of that :slight_smile:

That said, I have had an issue where intermittently the new project wizard fails to create the run configurations. There’s some sort of race condition happening within the project creation process. And despite all my attempts (and there have been several) to mitigate it, it still happens. Although now far less frequently than it once did. I was thinking of adding an option to the tool menu to create the run/debug configs via it to allow manual creation for the cases where it fails. I actually have an action that does that that I used when testing, So it would be just a matter of adding it to the menu. (For the first pass, I can just add it as is. Ideally it should not duplicate any existing ones.) I’ll try to get that out sometime soon. Our regional is Mach 10-12. So it’s crunch time at the moment for me. (Just once I’d like the hardware team to be done on time :roll_eyes:)

Just for clarification, were these projects created in via IntelliJ IDEA’s New FRC Project wizard? And if so, does this seem to happen frequently when creating projects in IntelliJ IDEA? In my testing, it seems to happen around 5% of the time.

Thanks.

3 Likes

This plugin is a really nice addition to Intellij, so thank you very much for making it. I have had numerous years where the students wanted to use Intellij instead of VSCode and this year they really wanted to use Kotlin, so it basically all but forced us to use Intellij. It’s a really nice IDE and the one I use at work as well anyway.

Unfortunately, we were only 1-for-5 projects that were created using the New FRC Project Wizard getting all of the run configurations on completely different computers yesterday. I spent a few hours trying to figure out why sometimes reopening Intellij will give the following dialog box and sometimes gives nothing. I was looking for some kind of menu option to force the project to reinstall the run configurations, but from the sounds of it that only happens at project creation time. It seemed like the new Download Pre-build shared indexes option might have something to do with it, but wasn’t sure.

image

I think that there is some secret rule in the mechanical team’s handbook that says that they aren’t allowed to release the robot for programming until the day before the regional.

Thanks for your thanks Warren. While I enjoy working on it, writing the plugin is a lot of work. So it’s nice to know people are using it and appreciating it.

I spent a few hours trying to figure out why sometimes reopening Intellij will give the following dialog box and sometimes gives nothing.

The notification you show should only appear if you open an FRC project – or more specifically, a project with the WPI Lib library as a dependency – and the FRC Plugin is not installed (or is installed and disabled). That notification is generated/managed by the IDE itself. As of IntelliJ IDEA v2020.1, plugin authors are able to register artifacts (using their Maven/Gradle GAV coordinates) with the IntelliJ IDEA Plugin ecosystem (aka “JetBrains Marketplace”) to say “Plugin XYZ provides support for this dependency”. Then if someone opens a project with that dependency attached, and the plugin providing support is not installed (or is disabled), that notification pops-up. If you click “Configure plugins…”, it should take you to the IntelliJ IDEA Plugin setting dialog so you can install (or enable if installed but disabled) the FRC Plugin. If you are getting that that pop-up in an IntelliJ IDEA instance that has the FRC Plugin installed and enabled, then that is concerning. (Let me know if that’s the case.) It would be a bug in IntelliJ IDEA since my plugin literally does nothing but list two WPILib artifacts in its plugin.xml configuration file. (Which the Marketplace parses when I publish my plugin, and the Marketplace registers it as supporting those libraries/frameworks.)

Configuring the project as an FRC project should happen when you open one that has not previously been configured as such. I have not done extensive testing on opening up projects created outside IntelliJ IDEA. (When you are a one person shop working on something like this, there is never enough time to test.) But the little I have done, has always seemed to work. That said, it may not be ideal. It basically looks to see if there is a class in the project (not the dependencies) that inherits from edu.wpi.first.wpilibj.RobotBase. That dates back to the days when the projects still used Ant. I have it as a lower priority item to modify that to add the facet if WPILib is attached as a dependency. That was a real pain to do in Ant based projects, but more doable in maven/gradle projects. It’s been low priority as there are more pressing things I want to get in. (I have enough to do that I could literally work on this full time if I was able to retire and do such.)

Is there a particular project that seems to cause issues? Or one created from a particular VSCode wizard template? (I port those templates over mostly as is from the WPI Lib code base.) Do you have a git repo that I could clone your project(s) from to use for testing? Feel free to DM me if that is preferred.

In the event that the project is not detected to be an FRC Project, you can add the FRC Facet to the {projectName}.main module. Go to File > Project Structure > Modules, right click the main module and select Add > FRC to add the FRC Facet.

If you are not familiar with them, you can read more about IntelliJ IDEA Facets in the user guide. I desperately need to write some documentation and a user guide for my Plugin. (Just one more thing there is never enough time to do.)

I was looking for some kind of menu option to force the project to reinstall the run configurations, but from the sounds of it that only happens at project creation time. It seemed like the new Download Pre-build shared indexes option might have something to do with it, but wasn’t sure.

As I mentioned in my previously reply, I’ll look at adding a menu options to create the run configurations. And your observations about indexing playing a part seem to match mine. In the plugin, the creation of the run configurations is done in a callback that is registered to run after project initialization has completed, and the IDE is in Smart Mode. The IDE switches between what it calls dumb mode and smart mode. Dumb mode is when indexing is occurring, and thus the IDE is not as aware of the structure. Creating the configuration has to be done in smart mode. I think what happens sometimes is that the project completes its initialization/loading, indexing completes, my run configuration creation callback starts, but then immediately another indexing operation starts, and it causes the configuration creation to fail. (It’s possible with the shared indexes that indexing happens as multiple sub tasks rather than one task.) I need to ask some questions of the IntelliJ IDEA Marketplace developer advocates to see if they can help me resolve this.

Kotlin is an awesome language. It’s great to hear that student’s are interested in programming with it! JetBrains has been doing a lot lately to promote Kotlin in education, including hiring an advocate whose sole job it is is to work with schools to add Kotlin to their curriculum. After the season is over and I have some time, I was going to send them an email suggesting they reach out to FRC about making Kotlin an official FRC language. I suspect they would provide lots of support to FRC and WPI Lib developers to make that happen.

Not sure if you saw it above, but I did add Kotlin Project Templates, and Kotlin Support for Projects this year. Let me know what else you’d like to see in terms of Kotlin support.

Ha! Indeed. I’ve been saying for years, a mentor we need the most is a project manager.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.