IntelliJ IDEA FRC Plugin Update Released for 2023 Season

For the 2023 season, I’ve released new version 3.0.1 of the (unofficial) FRC Plugin for IntelliJ IDEA . Versions 2022.1.x, 2022.2.x and 2022.3.x of IntelliJ IDEA are supported for all editions (Community, Education, and Ultimate). As of last year, I am increasing the major version number each build season for better clarity of when the plugin supports the next build season. Hence the 3.0 version.

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

2023 WPILib Support and Templates

I’ve updated of the New FRC Project Wizard to support the 2023 templates. The Java templates are direct ports of the official WPI Lib templates, with the ability to add some enhancements such as Kotlin support, include a customized the .gitignore file (or exclude it), and more. The Kotlin templates are my conversions of the official Java templates, and are modified to be more Kotlinesque. The Kotlin files are created in src/main/java rather than src/main/kotlin so you can very easily use both Java and Kotlin code in the project, with the classes living side by side.

Creation of Run/Debug Configurations

When you use the the FRC Project Wizard within IntelliJ IDEA, it creates a series of IntelliJ IDEA Run/Debug Configurations for running the various gradle tasks to build and/or deploy the robot, and for attaching the debugger. In the past, this was the only time or way to create the run/debug configurations. As requested in this comment by @warren.parsons IntelliJ IDEA will now create the run debug configurations when adding the FRC Facet. The FRC Facet should automatically be added when opening a robot project for the first time in IntelliJ IDEA, such as one created externally. (You can also manually add the FRC Facet to the Gradle main module as described in the IntelliJ IDEA documentation.) Finally, you can add the run/debug configurations via an action from the menu: Tools | FRC | Create Run/Debug Configurations | Create Build, Deploy, and Debugging Run/Debug Configurations . Note that the configurations are saved in a .run directory in the root of the project. This directory can be stored in Git (or your version control of choice) for team sharing. Its presence will not affect VS Code users.

Previous features

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

You can, as of 2023, also create these run/debug configurations via the menu: Tools | FRC | Create Run/Debug Configurations | Create Build, Deploy, and Debugging Run/Debug Configurations.

Theses run/debug configurations are stored in a .run directory in the root of the project to allow sharing via git. It you do share via git, when updating the project in another instance of IntelliJ IDEA, they may not get recognized and added to the UI immediately. Closing the project and reopening will result in their discovery. (This is a core IntelliJ IDEA feature and the delay of them being recognized is out of my hands.)

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, or giving it a quick 5 star rating, or leaving a review. 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 soon 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.

14 Likes

very cool! I might go check it out later

I tried out using intellij for programming a week or two ago and it worked great (though the plugin wasn’t supported because I didn’t update intellij but that’s fixed now) but now it will not build the code at all, throwing this error

A problem occurred configuring root project ‘robot-2023’.
Could not resolve all files for configuration ‘:classpath’.
Could not resolve edu.wpi.first:GradleRIO:2023.4.2.
Required by:
project : > edu.wpi.first.GradleRIO:edu.wpi.first.GradleRIO.gradle.plugin:2023.4.2
No matching variant of edu.wpi.first:GradleRIO:2023.4.2 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute ‘org.gradle.plugin.api-version’ with value ‘7.5.1’ but:
- Variant ‘apiElements’ capability edu.wpi.first:GradleRIO:2023.4.2 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8
- Other compatible attribute:
- Doesn’t say anything about org.gradle.plugin.api-version (required ‘7.5.1’)
- Variant ‘runtimeElements’ capability edu.wpi.first:GradleRIO:2023.4.2 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
- Other compatible attribute:
- Doesn’t say anything about org.gradle.plugin.api-version (required ‘7.5.1’)>

everything works fine when I use vscode so it isn’t an error with the project. Any ideas?

Edit: so apparently I hadn’t set the java version correctly so it was trying to use java 8 instead of a newer version… I thought I had set that right but no no lol.

BTW I absolutely LOVE your plugin and the work you have put into it! I have successfully converted all of my students to love InteliJ and Jetbrains because of it too! :slight_smile: (which we know will help them in future careers).

Thank you for all your effort!

1 Like

Hey, is it possible to add this functionality to your plugin? Another cool enhancement is to put the last match number in the commit message (IIRC that could be extracted from the DS log files).

Hey @dan, I’ve opened a feature request for your ask. I’ll see what I can do. I can’t make any promises, especially for this coming competition season. I sadly just don’t have as much time to work on the plugin as I’d like. And I have some other pressing feature requests and issues to address. But I might be able to get something basic in for this season and then enhance it in the future. But again, no promises.

1 Like

Is there an ETA for 2024 project generation support?

Thank you!

I’m working on that now as we speak. I hope to have it done today. But it may bleed into tomorrow and/or Thursday. It then takes up to 2 business days for the plugin to clear screening. So hopefully it will be available before this weekend, but more likely next week Tuesday or Wednesday if not due to the holiday on Monday.

3 Likes

probably not related to the plugin but is about intellij. Somewhat recently (in the offseason) I went to create a project but when I tried to build the project, it would crash in intellij. using vscode it would build fine. I did go check my java settings just to be sure that I was using the right one

As someone that’s used IntelliJ IDEA daily for work for 21 years – and having spent a lot of time in the forums over that 21 years – I can tell you that it’s pretty rare for IntelliJ IDEA to out right crash. It has really good exception handling that will catch almost all issues. If it does crash, it is usually a sign of a corrupt file. Either in the project or the IntelliJ IDEA installation. So I’d try it on a fresh project (i.e. re-clone it from git, or create a new one) and/or reinstalling IntelliJ IDEA. You can also take a look at the logs (Help > Show Log in Explorer) and see if it reveals anything. Finally, while I can’t see a corrupt index crashing IntelliJ IDEA, I suppose anything is possible. So try invalidating the caches (File > Invalidate Caches…).

1 Like

oh no intellij does not crash. building the code crashes if I use intellij but not if I use vscode

@Javaru Have you ever managed to get a remote debugging session to work with intelij on a RIO so you could do profiling?

@nstrike Apologies for missing this when you posted. I have attached the debugger to the roboRIO in the past. I’ve have not specifically tried profiling. I’ll try to get some instructions written up for attaching a debugger. And I will see if I can get profiling working. I fully know that a big shortcoming of my IntelliJ IDEA plugin is a lack of documentation/instructions. It’s been on my to do list. There’s just not enough time in the day :pensive: But debugger attachment is an important one. So I’ll try to get something written up for it. Again, sorry I missed this when you posted.

2 Likes

Im curious, are you aware there’s a bug in the kotlin command based template?

Hi @Tatiman-Dev , can you be more specific? I just published an update this past Monday that fixed a few minor things, including a potential corner case issue in the Gradle build file for a Kotlin Robot. But I’m not aware of anything specific to a problem with the Kotlin Command template. If you can let me know the specifics here, or open a bug report, I’d be happy to get it fixed ASAP. I love Kotlin and want to see more teams using it. So anything I can do to help with that is a priority for me. Thanks.

1 Like

Unfortunately I’m unable to use GitLab (It says my email exists but refuses to send me a password reset) So I can’t submit a bug report.

The problem is very simple, in the default RobotContainer.kt object, drivercontroller’s intitialization is placed below the call of configureBindings, this causes the robot code to crash as it tries to access driver controller before it’s created.

 init
    {
        configureBindings()
        // Reference the Autos object so that it is initialized, placing the chooser on the dashboard
        Autos
    }

    // Replace with CommandPS4Controller or CommandJoystick if needed
    private val driverController = CommandXboxController(OperatorConstants.DRIVER_CONTROLLER_PORT)
1 Like

Thanks. I’ll get that fixed. (Bug report in GitLab.)

When I update the templates each year, for testing, I do my best to build a project created by the templates. But I typically do not have the time to also deploy to a roboRIO and try running them to catch runtime issues like this. In the future I’ll try to at least run a project for the primary templates. (And ironically, I have a custom Kotlin Command Based Robot template that I use for our team, so I did not notice this.) Thanks again for letting me know.

Thank you!

Does the debugger stuff work? And does it work the same as like, normal debugging when its running, or is there info on how to use it?