Which Rust IDE should you choose?
Rust is, according to Stack Overflow Insights, the most ?Loved? language of 2018 with an incredible 78.9% rating ? Rustaceans out there are clearly happy on average. However, Rust didn?t appear in the same survey?s ?Most Popular Technologies? section, indicating that the amount of overall users is still quite small.
It should come as no surprise after the survey then that many people are rushing to try it out, and when that time comes, the question inevitably arises: which IDE should you use to develop in Rust?
As of today, there is no clear monopoly on Rust IDEs and thus no clear-cut winner. As much as it feels like that can make it confusing, this can actually be a good thing as there are a variety of choices that will ultimately boil down to user preference.
This article will take a lot of internet opinions and attempt to illuminate both the pros and cons.
IntelliJ IDEA with IntelliJ Rust plugin
Rust with IntelliJ IDEA (credit matklad on GIPHY)
You can find the installation link here on the IntelliJ Rust website.
- Open-source
- Written by some JetBrains employees and volunteers
- No debugging
EDIT (5/28/19): According to reader Chris Vest:
It can do debugging when installed in CLion.
- Free for community edition, license for premium version
- Refactoring capabilities
- Supports adding of new modules
- Supports stubbing out trait implementations
The feature set is amazing, but I find it slow? Does anyone else have this issue? It sometimes takes minutes for syntax and error highlighting to update after I type some new code.
? /u/NeuroXc on /r/rust
I?ve used both vim with the rust.vim plugin and Intellij with it?s Rust plugin. Intellij has the most complete ide experience I?ve tried and the best completions but I still prefer vim.
? /u/Zethra on /r/rust
I use Intellij with the Rust plugin. I?m already using Jetbrains IDEs a lot for uni work, so it made sense to stick to that.
? /u/FlourineWizard on /r/rust
I had been avoiding intellij due to the lack of debugger (only works in clion).
Upon trying out intellij, the completion worked kind of great immediately (after the initial index). However then I started running into odd things. I don?t have nightly anything setup, however it completes things in nightly. It looks like it complies in IDE, until a build is run, then it doesn?t. I can?t figure out how it?s getting those or how to disable it.
Intellij does have tons of refactors others don?t. It has things I missed in vs code that I have feature requests in for.
However, it does have other issues like it will randomly say things don?t compile that do. It will say missing method. However, if you delete the line, it will come complete it, then again say missing method.
Then just a side note, intellij is by far the most heavy weight IDE. It barely runs on my laptop (which is really old in all fairness, and I should probably get another one), where the other ones ?work? fine (whatever you want to define that for eclipse, and vs code was great until I did whatever to break completion).
I think the real answer is we aren?t IDE yet.
? /u/r3vj4m3z on /r/rust
IntelliJ rust plugin is really good. I used vim+racer+ycm for a while, and I do love Vim, but especially for big, production projects with lots of modules and deep hierarchies, IntelliJ is just much more productive (stuff like rename struct field works across the whole code base)
? /u/neuronsguy on /r/rust
Intellij-rust was certainly extremely easy to get going with, but the bloat of IJ itself drove me away.
? /u/Cldfire on /r/rust
It works very well and has active development.I definitely recommend it if you can spare the RAM and CPU usage.
? chimmihc on rust-lang.org
EDIT 6/24/19: Reader Joseph Noose had the following to add:
For me the big plus of IntelliJ over VSS was the let completions, that sometimes when dealing wit 3rd parties it becomes quicker and easier to see what object is being returned. I found with some of the diesel stuff it was especially useful since the objects are rather long
CLion with IntelliJ Rust plugin
Another option with JetBrains, CLion is a C/C++ IDE that can also support the IntelliJ Rust plugin.
- Allows use of Cargo build system
- Support for debugging Rust applications ? unlike IntelliJ IDEA
- Requires commercial license (or free with .edu e-mail address)
Clion with the Rust plugin for intelliJ is probably as close to a Rust-specific IDE that exists; however, the Eclipse project may make one, it?s currently being discussed.
? /u/steveklabnik1 on /r/rust
Debugging support in CLion is excellent! Doesn?t get nearly enough praise. Inlined runtime values in code at breakpoints is nice (1) , so is the debugging inspector (2), and, setting conditional breakpoints? very comfortable to do.See: 1 2 3
? /u/Monadic_Malic_Acid on /r/rust
VSCode with Rust plugin
VSCode with Rust (credit rust-lang.org)
- Open-source (free)
- Built-in Cargo support
- Code completion
- Jump to definition, peek definition, find all references, symbol search
- Types and documentation on hover
- Code formatting
- Refactoring (rename, deglob)
- Error squiggles and apply suggestions from errors
- Snippets
- Build tasks
- Powered by the Rust Language Server (RLS)
- Format on save, if desired
VSCode has good Language Server support, which means the new RLS features work very well in it. It is more of a traditional IDE experience, but I prefer to use a tmux session as my IDE with Vim as my code editor.
? /u/IDidntChooseUsername on /r/rust
+1 for VSCode + Extension. Why? Some people just want to watch the world burn. But seriously. VSCode is a really, really good editor.
I use it for C, C++, C#, Javascript, Erlang, Prolog, Lisp, F#, and now Rust.
No emacs pinky.
Just works right out of the box.
Command pallete is also pretty baller.
They replaced their grep system with the rust version recently and got massive performance increase. I am literally here because of VSCode release notes from about a week or 2 ago.
Solid Git integration.
Cross platform.
Did I already mention that I like to watch the world burn?
? [deleted] on /r/rust
I use VS code with the rust extension for all my rust coding. It?s served me very well so far, anything that I can?t do with the key combinations provided by the extension can be done with the integrated console, so I really have no complaints.
? /u/YourGamerMom on /r/rust
I would recommend VSCode, the Rust plugin provides autocomplete, syntax highlighting, and some other nice features. But above all, there is a nice LLDB plugin that allows Visual Debugging which is an advantages over other IDEs I?ve tried.
And it?s cross platform.
? mczarnek on rust-lang.org
Having spent 3+ weeks each using intellij-rust, vscode-rust and various different plugins for rust support in Sublime Text 3, I can confidently say that the best experience I?ve had up to this point was with the vscode plugin(s) ? Vscode strikes the perfect area for me; it was instant to get up and running with (since I already had the necessary tools cargo install?d and the rust src component added via rustup, everything worked out of the box) and still maintains the editor experience. The only thing I haven?t been able to get working is the LLDB frontend, but that?s due to my use of the WSL, not the fault of the plugin itself.
TL:DR, I recommend vscode.
? /u/Cldfire on /r/rust
(Neo)vim with Rust plugins (like rust.vim, vim.racer)
Example of Rust with Vim (credit Jovansonlee Cesar on GitHub)
Really used to Vim and can?t stray from its various text manipulation commands? Have no fear ? plenty of people use Vim when developing in Rust.
You can go with a plain vanilla Vim installation, or you can use other flavors such as Neovim.
Neovim
- Open-source
- Community-driven
- Access to executing jobs / tasks asynchronously in vim (h/t Dhruva Sagar on StackOverflow)
Whatever flavor of Vim you use, you can leverage Rust-specific plug-ins.
rust.vim
- Rust file detection
- Syntax highlighting
- Formatting
- Syntastic integration
- Requires Vim 8 or higher for full functionality
vim.racer
- Allows vim to use Racer for Rust code completion and navigation
Vim, and it?s kinda painful tbh. I?m open to suggestions. The text manipulation side of Vim is incredible. It?s just mind blowing. But the rest of Vim is pretty sh*t, and with the types of complex errors you get in Rust it?s pretty painful to be switching across to the terminal.
I want to switch to VSCode or similar, but the lack of Vim editing commands is really stark.
? /u/jl2352 on /r/rust
With enough plugins (things like language servers, etc) you can make the rest of (neo)vim really usable, imo.
? /u/ashfordneil on /r/rust
I?ve used both vim with the rust.vim plugin and Intellij with it?s Rust plugin. Intellij has the most complete ide experience I?ve tried and the best completions but I still prefer vim. I?d recommend trying the setups mentioned on https://areweideyet.com/ and seeing what works best for you.
? /u/Zethra on /r/rust
Interestingly, some purists don?t use Rust plugins at all!
Vim with builtin auto complete (+ autocomplpop). Fugitive. That?s basically it? No more fancy plugins! And yes, I work on big codebases with this setup!
? /u/musicmatze on /r/rust
Emacs
emacs-racer by racer-rust (credit RecordNotFound)
I feel like if you?re going to include vi(m), you should probably at least give emacs a mention.
?
Add to that that there is a project to port emacs to rust. I use it as a drop-in replacement for emacs on my linux machines.
Note: I don?t actually use emacs for any heavy rust development. I?m going through my rust learning journey using IntelliJ IDEA.
? Chris Woods in this post?s comments
- With Racer, offers code-completion
- Has Cargo (package manager) support with key combinations
- Has rust-lang configuration for Rust-specific programming in Emacs
- Supports rustfmt with rust-lang
- Free
You should use MELPA and use-package to install packages in emacs.
Configuring Rust to use RLS on emacs is a bit tricky for a beginner. Here is my RLS configuration if you?re interested: https://github.com/CSRaghunandan/.emacs.d/blob/master/setup-files/setup-lsp.el and https://github.com/CSRaghunandan/.emacs.d/blob/master/setup-files/setup-rust.el
? /u/CSRaghunandan on /r/rust
I say this as someone still learning Rust, and not as a recommendation for people who make real contributions to production code.
I use Emacs in Rust mode with no other frills.
If my code is complicated enough that I need an IDE to follow it, it?s complicated enough that someone else won?t be able to follow it with that aid. And if I need autocomplete to know what function I want to call and its type signature then I probably don?t have any business calling it without giving the docs at least a once-over anyway, so it?s no extra trouble to just look it up.
? /u/bxtk on /r/rust
Sublime with Rust Enhanced
Sublime with Rust Enhanced (credit rust-lang via packagecontrol.io)
- Open-source (free)
- Goto anything
- Goto definition
- Split editing
- Low profile
It works quite well, yet it could be a bit more user-friendly. This however is more of a Sublime problem than a plugin problem.
? /u/booooomba on /r/rust
I tried it, but I missed refactoring tools, a good integrated terminal, and type on hover compared to VSCode + Rust plugin.
? /u/Foo-jin on /r/rust
Only annoyance is that it does not consider tests, and therefore does not catch compile errors in them, and spews a LOT of warnings about unused functions. (Writing tests first for my lib)
? /u/Rawler82 on /r/rust
It doesn?t have the best features set, but it?s fast and small (low on RAM and Disk Space).
? /u/razrfalcon on /r/rust
Sublime Text 3?s plugin situation is, at least for me, rather wonky; while I was able to get things mostly working on macOS, I was never able to get working autocomplete on Windows 10 (in addition to the rather long and painful setup time).
? /u/Cldfire on /r/rust
Some people don?t use any additional plug-ins with Rust Enhanced.
I use Sublime Text for everything. As far as building goes, I just keep a terminal window open at the bottom of my screen with cargo watch running.
I don?t have any Rust specific plugins, but given all the recommendations here, I think I?ll try out the Rust Enhanced plugin later.
? /u/Uncaffeinated on /r/rust
Atom with Rust packages
Atom with IDE-Rust (credit atom.io)
IDE-Rust
- uto-completion
- Diagnostics (errors and warnings from rustc and clippy, see clippy_preference setting)
- Document outline
- Go to definition (ctrl or cmd click)
- Type information and Documentation on hover (hold ctrl or cmd for more information)
- Find references (ctrl-alt-shift-f or cmd-opt-shift-f also in context menu)
- Format file with rustfmt (ctrl-shift-c or cmd-shift-c also in context menu)
- Format on save (disabled by default, see atom-ide-ui settings)
language-rust
- Adds syntax highlighting and snippets to Rust files in Atom
linter-rust
- Linting your Rust-files in Atom, using rustc and cargo
- Files will be checked when you open or save them
??????? (tokamak)
- Syntax highlighting
- Creating Cargo project
- Support for Cargo projects
- Code Completion with Racer
- Managing Rust toolchains
- Code Linting
- Project specific configuration
- Code formatting
- Go to definition
- Hover for documentation
- Find references
- Outline for the file and the project
- Autocomplete out-of-the-box
- Code highlighting
racer
- Providing intelligent code completion and ?find definition?
I am using language-rust, linter-rust, racer (autocomplete) and atom-beautify on a rustup installation. Setting up the paths took a while but it works pretty well. I did also try to switch to Tokamak a while ago, but that didn?t work for me.
I?m running my rust code in a separate zsh window which is tiled the side by some Gnome addon and always visible (I don?t feel ready to go i3). With a file tree, a code view, a minimap and a terminal window there are four columns in total and it feels a bit cramped at times. When I don?t have a big monitor attached to my laptop I run atom in fullscreen.
? roSievers on rust-lang.org
I was using Atom for Rust for about 9 months, having previously used Atom for all my Python development. I did much the same as @roSievers above, but I found recurring problems on macOS (especially with environment variables not being passed through without fuss). I was never able to get Tokamak running properly.
? pwrdwnsys on rust-lang.org
honestly i don?t think sublime compares to the functionality there is in atom for rust.
startup speed is slow, but everything else is totally acceptable.
and i prefer the linter and linter-rust packages, as they?ll show you compile errors and warnings inline sec after you press ctrl+s!
? /u/flying-sheep on /r/rust
Eclipse Corrosion (Eclipse IDE for Rust Developers)
Eclipse IDE for Rust Developers (credit Corrosion on GitHub)
- Helpful if you?re already used to Eclipse
- Integration with the Rust Language Server and Cargo
- Completion Assist
- Documentation Hover
- Diagnostics
- Formatting
- Variables View
- GDB Console
- Breakpoints
- Expression Execution
- New Project Wizard
- Toolchain Management
- TOML file editing support
- Export Crate Wizard
- Rust Language Server Preferences
- Project Outline
- Dark Theme
- Problems View
- Git integration (Only available in Corrosion Package)
- Open-source (free)
It also has export as Crate, Execution and Debug support (over GDB) integration; those are not provided by RLS but by direct integration with cargo and rust-gdb
? /u/mickael_istria on /r/rust
There are a lot of options, and ultimately a method of trial-and-error may be most effective in terms of determining which IDE specifically to use. If you have any additional opinions or comments, don?t hesitate to leave them below. Happy Rust coding!
Other recommended reading
- https://areweideyet.com/
Also on cloud native: the gathering
What is the best IDE for developing in Golang?
What should you use to edit your Go code? I compare the options.
medium.com
Footnotes
- Reader Francesco Dainese pointed out in a previous version of this story that the it can be misleading to say there are a lot of Rustaceans out there since the Stack Overflow metric is ?Loved? as opposed to ?Popular?.
- Reader Chris Woods suggested that if Vim gets a mention, so should Emacs ? the latter of which a previous version of this story unintentionally left out.
- Reader Mickael Istria suggested including Eclipse IDE for Rust Developers through Corrosion.