IntelliJ IDEA FRC Plugin Update Released - Jan 2, 2020

Just in time for Kickoff 2020, I’ve released a new version of the (unofficial) FRC Plugin for IntelliJ IDEA . Versions 2019.2.x and 2019.3.x of IntelliJ IDEA are supported for all editions (Community, Education, and Ultimate).

Installation

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

What’s New

New Project Wizard

In addition to the some polishing of the New Project Wizard announced in the last upgrade , all the 2020 project templates and examples form the WPI Lib project creation tool were ported over. There are now 45 example projects (up from 18). They will appear when a 2020 version of WPI Library is selected on the first step in the wizard:

Several Gradle Run & Debug Configurations are now automatically created when you create a new project. (You can of course edit or delete them.) They are all accessible via the Run drop down, or in the Gradle ones in the Gradle tool window. (The “Debug Robot” ones to attach the debugger are of course available only in the run window since they are not Gradle execution configurations.)

Gradle Run & Debug Configurations - Drop Down

Gradle Run & Debug Configurations - Gradle Tool Window

Updated New Class feature

The new class/component feature was completely rewritten to take advantage of more features in the IntelliJ IDEA API. Now instead of just being prompted for the name of the class, additional options are available. For any applicable components, you will be asked what class to use as the base class. In addition to the ones from the WPI Library, any relevant abstract classes or classes who’s name ends in “Base” from your project will be listed. For example, in the below screenshot, two Team specific base classes are shown.

When creating New Commands, all available subsystems are listed and can be selected for inclusion. Those selected will automatically be imported and added to a call to the addRequirements() method.

New Command Dialog

Example new command

The Subsystems options include the ability to create the Subsystem as a Singleton.

To ensure quick class creation, your selections are remembered for the next time the dialog opens … except for the desired base class. I did not get a chance to add that yet. But it will be included in a new update soon, likely next week.

The templates also support both the “original” version 1 Command Based API as well as the new Version 2 Command Based API being introduced this year. The templates automatically change based on which version of the API your project is configured to use in the Gradle Build.

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, and clearing of the output. It also provides native supports the awesome Grep Console plugin providing you with 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 :wink:)

New in this update, the RioLog Console reads the team number from the project’s wpilib_preferences.json file. Previously it used an application wide configured team number. This supports teams that create a second robot using a different team number.

wpilib_preferences.json Schema

Schema suport for the wpilib_preferences.json file was added. While you should never have to edit this file manually, it’s good to know you now have error highlighting and code completion available to ensure that it is correct.

wpilib_preferences - error highlighting

Miscellaneous Changes

The update includes a number of miscellaneous changes such as more words added to the FRC/WPI specific spell checking dictionary, the squashing of some bugs and quirks, and other improvements.

Feedback Welcome

As always, I 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 of 2020. The plugin currently has 4,659 downloads. Here’s hoping it crossed the 5,000 mark during the 2020 build season.

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

19 Likes

Thanks a ton! I’ll be trying this out later tonight, VS code has been super buggy for me so far, with errors popping up and going away seemingly at random.

1 Like

This is super nice. Thanks for doing it! One suggestion might be to add some doc for adding vendor dependencies so people don’t trip up on that step.

1 Like

Thanks @Brian_Selle for the feedback and suggestion. I sincerely appreciate it. It’s nice to hear people are finding my plugin useful. Even though there are a little over 2,500 unique downloads (and 4,987 total downloads) of it, I have received very little feedback about it.

I have thought about adding a feature for adding and/or managing vendor dependencies/libraries. I’ve opened Feature Request 61 to track it. Unfortunately it is not likely I will be able to get to it this build season since my team’s build is my primary non-job time focus right now. In the meantime, I’ll try to add some documentation on how to do such manually. (I am unfortunately behind in updating the docs. I wish I had a lot more time in the day.)

This is really cool. I didn’t realize this existed, so we will definitely look into it this weekend. The RioLog console look particularly great, especially if it has built-in grep support!

I totally missed this announcement the first time around. This is fantastic! Thanks so much for the work you put into this.

1 Like

Just a heads up that I released an update today to the IntelliJ IDEA FRC Plugin. It includes the following minor changes:

  1. I added an action to check for the availability of a WPI Lib update. When an update is available, the user is notified. The check is run in the background upon opening an FRC project, and then periodically in the background while the FRC project is open. The check can also be executed manually via the menu action Tools > FRC > Check for WPI Lib update. Future enhancements will offer a quick fix action link (in the notification) to automatically update the gradle build file with the new version, provide fine-grained control as to when the background checks occur (if at all), and provided better messaging, when manually launched, in the event the check failed (such as due to no network being available) rather than just reporting no update is available as it currently does.
  2. I fixed the auto clear feature in the RIOLog console tool window. It was keying on an old startup message. The auto clear feature, when turned on via the toggle button on the RIOLog console tool window, automatically clears previous output when the robot restart message is seen. This allows you to concentrate on just the most recent run and can prevent confusion from accidentally reading a log message from a previous code deploy by scrolling back too far.
  3. I rearranged the order of the action buttons on the RIOLog console so that the more frequently used actions are on the top to improve usability when the tool window height is reduced. In particular, the grep console configuration button (if you have that plugin installed) and the next/previous stacktrace actions were moved to the bottom since they are likely the least used actions. I also completely removed the print action as I figured that is likely never used and was just taking up space. Initially, I had the RIOLog console action buttons layout match the order that occurred in the Run tool window (when running non robot programs) for consistency with the core IntelliJ IDEA UI. However, over time, as IntelliJ IDEA has evolved, the Run tool window is used for fewer things. And I personally found when working on a laptop screen with a RIOLog console tool window that was reduced in height, that the buttons I used more frequently were not immediately visible. Having to click the “show more” button and then the desired action was a bit of a pain. If anyone feels these changes diminish usability, please open a ticket for discussion.

Finally, please note that while JetBrains has launched the v2020.1 EAP (Early Access Program), I am not making any v2020.1 EAP releases of the FRC Plugin available just yet. The IntelliJ IDEA Plugin API is changing significantly in v2020.1 (see this and this blog). It will therefore require a bit of time on my part to migrate the plugin to the new version. I will do my best to migrate the plugin and start releasing a a version for the 2020.1 EAPs. But as I’m sure you all know, time is precious during the build season. So I may not get to it until March. Since 2020.1 will likely not be released until late March, I think that timeline works OK.

As always, feedback about the IntelliJ IDEA FRC Plugin is always welcome. I hope people are finding it useful.

6 Likes

I’m having an issue with actually setting up the vendor libraries. Their respective .json files aren’t listed in the vendordeps file.

Hello @SupaNingen

The *.json files for the various vendors are not listed in the vendordeps directory by default. They need to be added there. This is true whether you are using VS Code or IntelliJ IDEA. Some examples – especially those you download from a source code repository – may include them. But the default robot project templates do not include them (other than the Command Based Robot projects do include either the WPILibOldCommands.json or WPILibNewCommands.json file). You add the *.json file for each vendor library you want to use.

The FRC version of VS Code does have an action to add a Vendor Library by putting its *.json file into the vendordeps directory. All it does is download a *.json file from a URL, or copy one from a folder on your system, and place it into the vendordeps directory. I have not yet implemented a similar action in the FRC Plugin. But I do plan to do such (you can watch Feature Request 61 for this). But ultimately this is a convenience feature. You can simply “manually” copy or download the desired *.json file(s) into your project’s vendordeps directory. (See the WPI Lib Doc’s 3rd Party Libraries section for a list of URLs where you can download them.)

After you put the *.json file(s) into the vendordeps directory, you will need to reimport (i.e. sync) the gradle project so that the libraries/dependencies defined in the file(s) are added to the project and the classpath. You can do this by opening the Gradle Tool Window in IntelliJ IDEA, and clicking the “Reimport All Gradle Projects” button (the two arrows in a circle on the Gradle Tool Window toolbar). I’ve created Feature Request 63 to have Gradle automatically reimport when files are added to the vendordeps. But I likely will not get to it until after the build season is over.

Summary

So in summary, until I am able to implement the two mentioned features, for now you need to just manually copy the *.json file(s) int vendordeps and then click the Gradle reimport button.

I hope that helps and answers your question. If not, please let me know, and give me some more detail and I will do my best to assist you.

Thanks!

I’ve released another minor update to the IntelliJ IDEA FRC Plugin with the following changes:

  1. Enhanced the New Subsystem “Create as Singleton” option to offer different Singleton initialization methodologies (based on the methodologies presented in the Geeks for Geeks Singleton Design Pattern article, which has a nice discussion about the usually mundane topic of Singletons). I thought it’s be nice to provide options.
  2. Added functionality to Command class creation so that Subsystems that are Singletons are not added as parameters to the Command’s constructor, but rather are initialized in their field declaration via a call to their singleton getter method (or singleton field if applicable) This also supports Subsystems that are Kotlin objects, and thus Singletons.
  3. Enhanced the Command class creation dialog so that abstract subsystem classes are not listed in the “required subsystems” selection pane. Since an abstract subsystem cannot be instantiated, it made no sense to present them as an option in the list.
  4. Enhanced the component creation dialogs so that the last selected base component is remembered and pre-selected on the next use.
  5. Implemented Feature #63: Auto reimport gradle project when changes are made to vendordeps directory so that changes are picked up and the project classpath is updated appropriately. (Note that Feature #61, UI for adding and managing vendordeps is still pending.)
  6. Some miscellaneous internal improvements.
2 Likes

This feature is really nice. However, it doesn’t reimport when I manually change one of the JSON files. It would be nice to have it prompt for a reimport when changes are made to those JSON files when we have to manually update them.

Hello @retrodaredevil
Thanks for the feedback.

As of the new version just released (v1.2), the plugin will automatically do a reimport when you save the file JSON, not as you actively edit it. But the save will trigger the reimport. See the below screen capture for an example. Notice after the save, the gradle import happens (as shown in the status bar). And then the notification appears once it has completed. If you are not experiencing this behavior, please verify you have v1.2. If so, let me know and I can try to troubleshoot the issue with you or see if there is a bug in the feature.

I can look at making a change so that if the file is edited, but not saved, after a certain period of time the file will auto save and the import would fire.

1 Like

Ah, I wasn’t aware of that. Then that’s not a big deal. I’m used to making a small change in my build.gradle then having IntelliJ prompt me to reimport the gradle project, but the functionality you have will work great for my use case.

1 Like

Yeah. I didn’t do the pop-up since doing it when saved was a quick hit. I’ll look at mimicking the behavior you described so it is a more consistent experience. I knew I’d need to take a second look at it anyways as JetBrains is planning to modify the Maven/Gradle import behavior somewhat when editing build files in v2020. Thanks.

Earlier this week I released a version of the Intellij IDEA FRC plugin for IntelliJ IDEA v2020.1 EAP (Early Access Program). It doesn’t have any new features, but is merely the first v2020.1 compatible release. As always, please report any issues or request features via the project’s issue tracker, or provide feedback here.

After our regional match this coming weekend (March 12-14) I’ll start implementing new features. A big one on deck is more Kotlin support including new Kotlin project wizards/templates and a one button action to add Kotlin to an existing project by modifying the Gradle build file. I programmed most of our Robot in Kotlin this year (as well as all new features in the plugin are done in Kotlin) and so I want to make Kotlin’s use for programming a robot more of a first class feature.

Will this plugin be sustained for the 2021 season and for the foreseeable future? I’m considering switching our team to use IntelliJ IDEA as our development environment and having this plugin for the future would be extremely reliable.

Yes it will be. In fact I spent most of today working on it. Right now I am making mostly internal changes to deal with major changes to the IntelliJ IDEA plugin API in 2020.1 and 2020.2. These include the depreciation of a number of previous core APIs related to how you basically structure a plugin. While time consuming to make, these are some positive changes. For example, one benefit will be that after these changes, updating the FRC plugin will no longer require a restart of IDEA as the FRC plugin will support dynamic reload of plugins introduced in 2020.1. At the same time, I am also able to deal with some technical debt as I make the changes. (Especially given that I have much more experience and expertise with the plugin API then I did when I first started this plugin there to four years ago.)

Once I have the plugin API changes handled, there’s a number of improvements I want to make and features I want to add. (I just wish I was retired so I could spend all day every day on this plugin as I have so many feature ideas.) High on my list is better configuration and management for vendor libs. It’s far too basic right now. And I want to add the ability to create 100% Kotlin robot projects to the new project wizard (since I code our Robot’s in Kotlin). And, and, and…

Also high on my list is to get the plugin documentation back in line. The migration from Ant to Gradle, and the associated library management changes, two years ago made all my documentation obsolete. But I had to spend so much time getting the plugin up to speed, I didn’t have any time to update the docs. (And I’m a typical developer who would rather write code the documentation.)

I keep an eye on the WPI Lib project and it’s documentation to be aware of any changes to the library so I can be prepared for them, as well as changes to the VS Code plugin so I can keep feature parity. (Although I feel my plugin combined with IntelliJ IDEA’s capabilities result in having far more features than VS Code. But I want to make sure my plugin doesn’t lack any that the VS Code plugin has.) Typical I focus heavily on this in November and December (when the WPI Lib project is more active) in prep for Kickoff.

I personally could never use anything but IntelliJ IDEA to code with. I’ve been using it professional for 17 years now (and with FRC since I started 8 years ago). So for that reason alone I’ll keep working on it.

My current plans are to keep doing this for the foreseeable future. I really enjoy working on the plugin. And I really enjoy mentoring for FRC. If I ever do have to give it up, I will do my best to get someone else to adopt it. But again, hopefully that won’t be for a long time and our Robot’s will be programming themselves at that point.

If there are any features you would like to see, please open up a feature request. Or let me know if you have any other questions.

4 Likes

Thank you for your contributions, I’m definitely gonna be pushing for using this plugin now that I know it’s sustainable. My only problem is how we would still need to use vs code for vendordeps, but it looks like it’s getting handled. Good luck to you and thank you again.

1 Like

About vendordeps (@Javaru - a GUI in the plugin that uses this would be helpful): I currently have an open PR to gradleRIO that adds a gradle task that downloads the JSON file from a URL - it’s very similar to the VSCode Online method, but it doesn’t download the dep to mavenlocal (so you’ll need to have an internet connection for the first build). I hope it will be merged before the 2021 season (if that happens), and perhaps before the 2021beta release.

1 Like

Thank you for the feedback. I admit the vendor dependency support is currently very limited. That was purely due to a combination of there being other needed features with higher priorities and not having enough time during the 2020 season. Currently you need to manually download the json file(s) and put it/them into the vendordeps directory. The plugin does “see” the new file and automatically fires off a gradle re-import. But again, this is obviously not ideal.

I just updated the feature enhancement ticket I had previously opened on vendordeps, and also changed its priority to high. I added a list of the things I plan to add for this. @Derek_Geng and @Starlight220 (and others), if you can take a look at that ticket, review my ideas, and let me know if you think the planned features are good or if anything additional is needed/desired.

@Starlight220, your PR for gradleRIO sounds like a nice enhancement. In the case of IntelliJ IDEA, running that new task would cause IDEA to automatically re-import the gradle project as the FRC plugin currently monitors the vendordeps directory for any changes. Still, I’ll test this once your PR is accepted.

p.s. Derek, FYI, you said that you would be pushing to use this IntelliJ IDEA FRC plugin. If you get any push back, keep in mind you (and others) can use IntelliJ IDEA while others on your team use VS Code. While it is nice to have everyone using the same IDE, that is not always achievable. Being aware of this, my plugin offers to generate the VC Code config files when creating a new robot project.

1 Like