According to Stack Overflow’s yearly developer survey, Rust has been the most loved language for seven years in a row, albeit not one of the most popular ones. Rustaceans are drawn to the language due to its high performance, code safety features, and its amazing compiler.
In a relatively short time, Rust has gained backing from huge companies like Mozilla, Amazon, Huawei, Google, and Microsoft. For all these reasons, a lot of curiosity has developed around the language and a lot of people want to try it out.
In this article, I’ll share with you seven of the best Rust IDEs and code editors to optimize your coding experience, help you shorten development time, and provide you with tools to make the process of reading and writing code in Rust easy and efficient.
What we’ll cover:
- What should a good Rust IDE offer?
- Visual Studio Code (VS Code)
- CLion
- IntelliJ IDEA
- Atom Editor
- Sublime Text
- Spacemacs
- Neovim
What should a good Rust IDE offer?
A good IDE or code editor is ergonomic and can help increase your productivity. Some of them come with tooling to help you complete your code as you write, as well as for debugging your Rust apps before compilation.
Other features that you might expect from a good editor for a popular language such as Rust include syntax highlighting, hotkeys to speed up your workflow, and code generation. Without further ado, let’s dive into this list of some of the best Rust IDEs out there.
Visual Studio Code (VS Code)
Visual Studio Code is an open source and free-for-use project created by Microsoft and available for macOS, Windows, and Linux. It supports a lot of major languages, including Rust.
Currently, VS Code is one of the best code editors around and the most-used editor for Rust development. With the help of plugins like rust-analyzer
, VS Code provides Rust developers with features like:
- Error highlighting (and suggestions for possible fixes)
- Support for debugging
- Syntax highlighting
- Code completion
- Code generation and refactoring to improve quality of code
One of the main factors that make VS Code popular is that it is lightweight. It also comes with keyboard shortcuts to help increase productivity and language intelligence features like code navigation to help you find files, definitions, implementations, and symbols easily.
VS Code also comes with Git support out of the box, which is useful for maintaining different versions of your project. Other VCS plugins can also be found on VS Code’s extensions marketplace.
While similar to editors like Atom in terms of features, unlike Atom, VS Code is known for being fast and rarely causing lags when performing activities like searching and switching files. Another editor that is highly performant is Sublime Text, which we’ll talk about below.
Compared to editors like Vim and Emacs, VS Code is easy to set up and use. Since it was designed as a code editor, it doesn’t come with as many features as a standard IDE; nonetheless, it is highly extensible and its collection of features is impressive.
According to the rust-analyzer
docs, VS Code is currently the best-supported editor for Rust. You can download VS Code to see for yourself. Make sure you install rust-analyzer
as well!
CLion
CLion is a premium IDE created by JetBrains. Though created for C and C++, you can use it with Rust through the IntelliJ Rust plugin. It’s available for Linux, Mac, and Windows.
Unlike Atom, VS Code, and other open source editors, organizations and individuals have to pay for CLion. It is free for students, teachers, open source projects, and coding schools; however, most developers will probably not qualify for the free license.
If you don’t mind paying a small monthly or yearly subscription fee, CLion can be your Rust IDE. It is easy to use, and its modern, intuitive user interface requires no learning curve. You can hit the ground running building your Rust project.
CLion is a full-blown IDE packed with a lot of features and, as a result, it is heavy and CPU- and RAM- intensive. Compared to an editor like VS Code, it tends to run more slowly. With mid-sized to large-sized projects, you might experience lags and freezes.
With the help of IntelliJ Rust, CLion is able to provide Rust developers with the following features:
- Code completion
- Breadcrumbs
- Code generation
- Code analysis
- Debugger
- Handy keyboard shortcuts
- Code navigation
- Code formatting
- Test tools
- Vim mode
CLion has a clean user interface and comes with a number of themes that you can customize to suit your taste. Download CLion to try it out for yourself.
IntelliJ IDEA
IntelliJ IDEA, while originally built for Java by JetBrains, can also be used to code Rust. Like CLion, this is possible through the IntelliJ Rust plugin. It’s available for Windows, macOS, and Linux.
You can choose from regular and custom themes to improve the look of IntelliJ IDEA’s very nice, friendly UI. Similar to CLion, IDEA is available to organizations and individuals for a fee, while students, teachers, coding schools, and contributors to open source projects can get it for free.
IntelliJ IDEA uses IntelliJ Rust to provide Rust developers with the following features:
- Keyboard shortcuts
- Accessibility features
- Smart coding assistance
- Error detection
- Code completion
- Automatic refactoring
- Inspections and context actions
- Code highlighting
- Live templates
- Debugger
IntelliJ IDEA provides Rust developers with version control tools out of the box, along with tools for collaborating with others in real-time.
Inside the IDE, you can clone your project, manage branches, merge conflicts, commit, and push changes. It also helps you seamlessly integrate your Rust project with container orchestration systems like Docker and Kubernetes.
One “drawback” of IntelliJ IDEA is that since it is an IDE, it is obviously not lightweight. It uses up more RAM and CPU power than VS Code, Atom, Spacemacs, Neovim, and other code editors. This can make opening large projects or working on multiple projects at a time really slow.
You can download IntelliJ IDEA to see all its features in action.
Atom Editor
The Atom code editor supports Windows, Linux, and macOS. While Atom is older than editors like VS Code, it has become less popular in recent times. It has a reputation for being sluggish, and it is clunkier than VS Code.
However, Atom has a customization flexibility that can only be topped by Spacemacs. Almost every feature is available as a package that can be easily added or removed. You can also create new features and tailor them to your taste.
Like VS Code, Atom has a great design, and you can create custom themes in it. Atom also has a huge, vibrant community behind it that both manages existing plugins and works on new ones.
Unlike editors like Emacs and Vim, Atom has a shallow learning curve. You can simply install it and start editing your Rust code immediately with its very intuitive interface.
With the help of packages like ide-rust
, which uses rust-analyzer
under the hood, Atom is able to provide Rust developers with features such as:
- Auto complete
- Syntax highlighting
- Version control
- Rust language snippets
- Go to definition
Download Atom to give it a try.
Sublime Text
Sublime Text is a minimalist but efficient code editor. It supports dozens of languages, including Rust. It looks bare compared to editors like VS Code and Atom, but that simplicity makes it much faster than those other editors.
Sublime is easy to use; it sports a user-friendly interface that requires no learning curve at all. It can run on Linux, Windows, and macOS. While its UI is not as customizable as Atom’s, it has a of lot of installable themes that can change the color scheme of your Rust code.
In terms of size, Sublime Text is much lighter than its modern editor counterparts, and it is super easy to set up. It is also quite extensible and customizable with the help of the plugins in its package manager.
Since Sublime Text is not open source, it has a rather small team behind it compared to its counterparts, making updates and bug fixes relatively infrequent.
There are many Sublime plugins available that make coding in Rust faster, easier, and convenient. With the help of packages like rust-enhanced
, it provides Rust developers with features like:
- Auto-completion
- Go-to function
- Code Folding
- Trimmer
- Emmet
- Color Picker
- Markdown Preview
- Git
- Syntax Highlighting
- Error Detection
You can download Sublime for free, but there are premium versions as well. Sublime will prompt you to upgrade to a paid license, but if the free version and plugins provide all the features all you need, you can simply ignore these popups.
Spacemacs
If you like your workflow to be keyboard-centric, Spacemacs might be the editor for you. With the help of key bindings, you can use the keys on your keyboard to carry out different commands and make the process of development faster and more efficient.
A drawback here is that it can take a while to get the hang of editors like Spacemacs; it has a steep learning curve. Unless you are already familiar with Emacs principles and codes, you might end up wasting a lot of time trying to figure out how to perform different functions.
If you have no experience working with Emacs or Vim for Rust development and you want to hit the ground running with your Rust project, Spacemacs is not the editor for you.
Spacemacs supports a lot of languages including Rust. Leveraging rls
and rust-analyzer
, Spacemacs is able to provide Rust developers with features like:
- Key bindings
- Auto-completion
- Navigation support
- Interactive debugger
- Lints with Clippy
- Inlay hints
- Code actions
When it comes to customization, Spacemacs is ahead of editors like VS Code and Sublime Text. Almost every part of the editor can be tweaked, and its functionality can be greatly enhanced through packages. Although VS Code’s functionality can also be extended through plugins, it’s somewhat restrained.
If you prefer to customize your development environment to your taste rather than work in an environment with an opinionated design, Spacemacs might be for you.
Although this might sound trivial, some people actually find Spacemacs more fun and adventurous to use than editors like VS Code and Atom. Others try it out of curiosity. So if you love to learn and are feeling adventurous, then it might be worth giving Spacemacs a try.
Neovim
Neovim is a flavor of Vim, the Unix text editor. It is very lightweight, fast and flexible, but its flexibility also means that it requires a lot of customization. If you don’t mind the time and energy that that takes, then it might be the editor for you.
If you like a minimalistic approach to editing, Neovim could also be a great option for you because you get to do all of your editing without having to leave your terminal. Neovim is also very light, which makes it very fast and responsive.
This free and open source editor has a vibrant community behind it, and it supports a lot of languages, including Rust.
Since Rust is a memory-efficient language, Neovim could actually be a good match as it is also light on memory resources. This may matter if you are using a small, inexpensive machine and managing how your CPU resources are used is a high priority.
With the help of rust-analyzer
, Neovim is able to provide features such as:
- Syntax highlighting
- Code completion
- Git integration
- Code folding
- Go-to definition
- Error detection
- Code navigation
Neovim’s key bindings allow you to perform all kinds of functions with your keyboard and not have to use your mouse. This can make for an efficient coding experience if you can use them well. Neovim is also very extensible, as there are plugins available for all kinds of features.
As modern editors like VS Code and Atom tend to collect users’ personal information, classic editors like Neovim are considered more secure.
Check out this Github guide to installing Neovim to get started.
Conclusion
All editors have their benefits, drawbacks, and place in the world of development. In the end, it probably depends on what you are comfortable with, your previous experience with editors, the kind of project you want to work on, and other factors.
If you are comfortable with performing most tasks with your keyboard and editing code from your terminal, then editors like Neovim and Spacemacs might suit you better.
If you are looking for something more modern with a shallow learning curve, then you can pick from VS Code, Atom, and Sublime Text.
However, if these feel incomplete and you need a more sophisticated, full-fledged development environment with a lot of tooling out of the box that is perfect for coding and debugging large projects, consider CLion or IntelliJ IDEA.
You can play around with all of them and see which one feels best to you.
The post Comparing Rust IDEs: IntelliJ IDEA, VS Code, and more appeared first on LogRocket Blog.
from LogRocket Blog https://ift.tt/RZCAUu3
via Read more