Nick Travers

Intellij

Various useful tidbits for Intellij and other Jetbrains products.

Clion - run / debug steals cursor focus

This one trips me up every time, as it's not really an issue with Clion itself, rather it's how the intellij-rust defaults work. When running or debugging a test (or the binary) from the IDE, the editor steals focus from the window with the code, and one either has to use the mouse, or some other combination of shortcuts to return to the code. This disrupts your "flow". Annoying.

To fix this, one must configure the Cargo Run/Debug template to not steal focus. Open the test / run configuration window ("Edit configurations..."). In the bottom left, select "Edit configuration templates...". Select "Cargo". Uncheck "Activate tool window" (at the bottom). Hit "Apply", then "OK".

One should also remove all of the existing configurations, as they'll most likely have the default behavior associated with them.

Now, when you run / debug a test / binary for the first time, your configuration will not steal focus.

At the time of writing, there's an open issue about this on the plugin's GitHub page.