Which IDE to use: VsCode, Intellij, something else?

Total newbie here, setting up for the first time. Which IDE should I use: VsCode, Intellij, something else? In the past I've used Intellij a lot, but nowadays it is a bit bloated. TIA!

1 Like

This works well:

If you’re considering VS Code, read this: Setting up Rust with VS Code

VS Code has a ton of nice features and is free, but it also is a bit of a pain to set up. Good luck on your future Rust endeavors!

1 Like

Thank you

If you use a linux type system, your text processor, and terminal (bash/sh) with cargo, etc are simple to understand and very powerful. The system itself is an IDE in my opinion. With it's own bloat of course...
(I build walls for a living so take my opinion with a grain of sand.)

3 Likes

I don't know which IDE supports Rust best, but I do know that VS Code is said to be the IDE that Rust supports best, that is, that the Rust project's rust-analyzer, which provides IDE integration, supports best:

VS Code

This is the best supported editor at the moment.

(Personally, I use GNU Emacs, and, although rust-analyzer is available, I don't use it, because of its notoriety for being expensive to run. I get the impression that rust-analyzer's target audience is users who would rather upgrade their hardware than downgrade their software, and I'm not in that audience. I do imagine that rust-analyzer would be worthwhile if writing Rust is one's job.)

With regards to Intellij, do note that it ships with a lot of optional stuff enabled which you will likely never use. Consider going through the plugin list and disabling everything that you don't expect to use in the foreseeable future. This can significantly improve the startup times, if not runtime performance.

Also consider increasing the limit of heap memory in the settings if you can afford it. I believe the default is 2GB, which is a bit too little in 2022.

Whatever you end up using, make sure that you can easily see the full error message that rustc outputs. Some setups will strip out all of the advice the compiler is trying to give you and just give a generic one-line description instead.

2 Likes

Do you need an IDE? Rust us just a programming language, that is human readable text. So you can edit it with the text editor of your choice. Compile with "cargo run"/"cargo build".

For decades I have been happy just using vim to edit all kinds of source code. I was generally annoyed by all the IDEs I had tried to use. They were often language specific, platform specific, large, slow and clumsy. Too many downsides to counter the luxury of syntax highlighting, run/debug, buttons etc.

Having said that a few year back I started using VSCode, firstly attracted because it was "just an editor", with the possibility of adding lots of options like syntax highlighting. It was fast enough, worked on all the platforms I wanted to use.

Now I'm kind of addicted to syntax highlighting when using Rust and the type hints are often very useful.

Still I often just fire up vim...

3 Likes

Note that if the most salient IDE feature for you is syntax highlighting, you might be missing quite a lot of useful stuff! Why an IDE? goes into some detail of what are the most impactful things IDE can do.

5 Likes

Sounds interesting, except I can't read that article because I can't scroll down the page. The slider does not work, arrow keys do not work. Using Safari here.

Of course if I could just read it as a text file in vim it would just work :slight_smile:

That's static page without JS, so I wouldn't expect it to break in any browser.

I guess that blog post is generated from this file in GitHub: matklad.github.io/2020-11-11-yde.adoc at master · matklad/matklad.github.io · GitHub

1 Like

Odd, I reloaded it a few times and it refused to work. Now that I come back to it again it works! Something odd with my Safari at the moment I guess. Sorry. Will now read it ...

It is a good sell. I guess I am just old.

Not much really, but an IDE does automate away some busywork:

  • rename a function or a variable and propagate the change to all their usages
  • extract a code snippet into a function
  • find all usages of a function
  • autocomplete aka Intellisense
  • format, lint etc.

If an IDE does just that, it's a great help. But when it's slow and bloated, it gets in my way instead of helping me.

Very convenient.

Just not thins I need to do much.

Formatting is what "cargo fmt" is for.

Finding things is what grep is for when I need it.

And so on.

grep itself knows nothing about the syntax of a programming language. You can't ask grep for all locations where a function is called, for example. A good IDE knows more about your code than simple tools like grep do which are designed to do one thing and do it well. An IDE is more than just a simple combination of tools because it is designed to work with code, not with arbitrary text.

That said, support for IDEs is something that the Rust project is actively working on. Take a look at the Rust Language Server, a tool that is explicitly build to support IDEs and advanced editors.

1 Like

My recommendation is to figure out a 'primitive' set of IDE ops you regularly use, and find the IDE that best supports those. For me, it is:

goto def under cursor
goto class
grep through all *.rs files
rerun last task
rename this variable (globally)

and I'm currently going with IntelliJ.

Oh, and one-click jump to file name / line number on compile error.

1 Like

Neovim offers a fully-featured IDE experience, but allows the user to avoid using the mouse. If you struggle with RSI, or simply do not want to develop it, this setup has allowed me to continue to code pain-free.

I shamelessly copied the Rust development environment walkthru video by @jonhoo.