Which Rust IDE offers most 'internal reprogrammability'?

  1. I used Emacs for a few years before switching to IntelliJ because Kotlin/IntelliJ just beat Kotlin/Emacs.

  2. When I started learning Rust, I stuck with Rust/IntelliJ.

  3. I am now at the point where I regularly want to do certain ‘auto refactorings’ that the Rust/IntelliJ plugin does not provide. For example, things like:

match XYZ {
  ==> press some key combo, insert all options of the enum that XYZ evals to

blahblah.foo(
  ==> press some key, inserts the name/types of the function arguments

and other shortcuts that take advantage of Rust’s type system.

To pull this off, I’d like a rust IDE that has lots of https://martinfowler.com/bliki/InternalReprogrammability.html

So far, I am looking at IntelliJ. However, I am a fan of neither the Grooby repl nor the Clojure repl.

I am also considering Visual Studio.

  1. Question: For those using Rust + IDE, have any of you managed to have an IDE where you can easily define actions that extends your Rust editing/programming experience? If so, what IDE / scripting language combo are you using?

Thanks!

Note that you need two things from the editor here

  • reprogrammability
  • understanding on the rust semantics

I’d say that IntelliJ is probably the best for the combination of two at the moment. There’s no something akin to init.el, but you can write your own plugins easily, and you’ll have access to semantic model of IntelliJ Rust (which has no backwards compatibility guarantees, of course).

Note that the first feature you ask for is already implemented:

image

This intention currently triggers only if the match is empty though, extending it to work when some of the cases are there would be very useful. If you are interested in improving this feature, do send a PR! The code for intention is here: https://github.com/intellij-rust/intellij-rust/blob/4e3c8bcb5983cc81ae549a281343c87822b5ffbd/src/main/kotlin/org/rust/ide/intentions/FillMatchArmsIntention.kt

The second feature isn’t there, but I think it should be handled by the combination of autocompletion and parameters into (ctrl+P).

A strategy which worked for me was to upstream all generally-useful intentions to IntelliJ-Rust, and just maintaining my fork for cases where I need this one-off project-specific refactoring.

4 Likes

@matklad : thanks for the insightful response

There is something in IntelliJ called “ide scripting console” https://gist.github.com/gregsh/b7ef2e4ebbc4c4c11ee9

It sounds like you are NOT using that, and are just straight up modifying the Rust plugin (written in Kotlin?) ?

Yeah, I am not talking about scripting console. Being an Emacs fan as well I’ve tried to setup solutions like that several time (there’s something similar called Live Plugin iirc) but wasn’t really successful.

As I’ve became more familiar with IntelliJ, I somehow began to feel much less need for such fine-grained custumizability. Instead, I’ve began to lean more on the build-in features, selected plugins(in particular, ace jump light and string manipulation) and on just pushing rust bits to IntelliJ Rust.

I hope this (discussing $) does not break any forum regulations.

Has anyone setup an “Rust/IntelliJ” bounty system?

I’m familiar with Kotlin, but find the IntelliJ API daunting (even with auto completion), and am willing to contribute $ to have certain features implemented.

I am thinking of a system where:

  • devs (people who have landed at least X commits) say: for $N, I can implement feature FOO

  • end users (like myself) can ‘vote’ via credit card by contributing $ towards bounties of features we want

  • when dev implements feature Foo, dev collects the bounty

==

There are a bunch of feature requests I would happily contribute $10-$20 towards (because the financial gain of increased productivity far exceeds that), and I suspect other Rust/IntelliJ users may feel the same way

It’s enough to file an issue to our tracker :slight_smile: