Can Rust Succeed? IDEs for Rust Development in 2021

Can Rust Succeed? IDEs for Rust Development in 2021

If you like it, follow us!

With the establishment of the Rust Foundation, the question of “Can Rust succeed?” has once again become a hot topic in the community.

This initiative, jointly established by four global top tech companies: Microsoft, Google, AWS, and Huawei, along with Rust’s creator Mozilla, undoubtedly gives a boost to developers in China who want to start learning Rust. Many friends have expressed that they will start learning Rust for the nth time.

We have compiled and updated a representative list of available Rust IDEs and related plugins and tools, hoping to help developers who want to learn Rust.

Rust Language Server: Rust Language Server

The Rust Language Server (RLS) is based on the Language Server Protocol (LSP), which was jointly launched by Red Hat, Microsoft, and Codenvy. It allows different code editors and integrated development environments (IDEs) to easily embed various programming languages, enabling developers to write programs in their favorite tools using various languages.

It communicates between development tools and language servers using the JSON-RPC standard, allowing programming tools to provide detailed real-time feedback and implement various powerful features such as symbol searching, syntax analysis, code auto-completion, go to definition, outline drawing, and refactoring. The Rust Language Server integrates these logics as a backend and provides them to frontend tools via standard LSP. It is designed to be frontend-agnostic and can be widely adopted by different editors and IDEs; however, the project team has only tested it in VS Code. Users can find the official Rust plugin based on RLS in the VS Code extension store.

Can Rust Succeed? IDEs for Rust Development in 2021

This is the official Rust plugin provided for Visual Studio Code. This plugin was initially a frontend reference implementation for the official Rust Language Server (RSL) and now also supports another community-maintained Rust server, rust-analyzer (RA). Users can choose to install either RSL or RA based on personal preference. This plugin supports:

  • Code completion

  • Jump to definition, peek definition, find all references, and symbol search

  • Type and documentation hover hints

  • Code formatting

  • Refactoring

  • Error correction and applying suggestions

  • Snippets

  • Build tasks

It is worth mentioning the features of snippets and build tasks.

Snippets are expanded code templates for common patterns. When typing, Intellisense will include the snippet names as options for quick selection. The following snippets are provided:

  • forCreate a loop

  • unimplemented

  • unreachable

  • print(ln)

  • assert(_eq)

  • macro_rules – Declare a macro

  • if let Option Execute in certain cases if let statement

  • spawn Create a thread

  • extern crateInsert extern crate statement

This Rust plugin provides tasks for building, running, and testing using related cargo commands. You can build using ctrl + shift + b and view other tasks in the command panel under “Run Task”. The content of these tasks is written in task.json, and the plugin does not overwrite existing tasks, so custom tasks can be created.

Community-Driven Rust Language Server: rust-analyzer

rust-analyzer (RA) is another Rust language server apart from RSL, developed by the community. Since its first precompiled release at the end of 2019, RA has been releasing new versions steadily every Tuesday. After rapid iterations, RA’s optimizations and improvements have now surpassed RSL, and it has been included as part of the RSL 2.0 plan by the official team. The official Rust plugin for VS Code has also added support for RA.

RA currently supports editors such as Vim, Emacs, Sublime Text 3, and VSCode, and detailed installation guidance can be found in the official documentation.

Rust Code Completion Tool: Racer

As mentioned earlier, both RSL and RA are Rust language servers that provide general capabilities as backends for IDEs and editors. On the other hand, Racer is a static library within Rust language servers that provides code auto-completion functionality.

Many IDEs and tools can easily integrate such underlying functionality, and currently, the following tools have implemented related integrations with Racer:

  • Eclipse

  • Emacs

  • Gedit

  • Gnome Builder

  • Kate

  • Sublime Text

  • Vim

  • VS Code

  • Atom

  • Kakoune

IntelliJ’s Rust Plugins: IntelliJ Rust and intellij-toml

IntelliJ Rust is the Rust plugin for IntelliJ, developed in Kotlin, with features including:

  • Support for native code suggestions

  • Powerful shortcut features

  • Fast code formatting

  • Snippets

IntelliJ Rust and intellij-toml bring Rust and TOML support to IDEA, CLion, PyCharm, and other JetBrains IDEs.

Language support includes syntax highlighting, completion, navigation, and other code insight features. You can use Cargo commands and run Clippy or Rustfmt without leaving the IDE. Debuggers and analyzers are provided in CLion and IntelliJ IDEA Ultimate. CLion’s integration also supports CPU analysis. For all other IDEs, debugging can be done using the native debugging plugin.

C/C++ Cross-Platform IDE: CLion

Can Rust Succeed? IDEs for Rust Development in 2021

CLion is an IDE specifically designed for C/C++ development, featuring:

  • Smart C/C++ editing: Native C/C++ support, including modern C++ standards, libc++, and Boost.

  • Navigation capabilities: Instantly navigate to the declaration or contextual usage of characters, search for classes, files, and characters by name throughout the project, and provide a structured and hierarchical view of the codebase.

  • Code generation: Easily complete code generation operations with simple shortcuts, including adding class members, overriding/implementing functions, generating constructors/destructors, getters/setters, determining equality, relational operations, and stream output operations, encapsulating code blocks with using statements and generating declarations based on actual usage.

  • Refactoring: Provides renaming symbols, moving members up/down in the hierarchy, and changing function signatures.

Through the IntelliJ Rust plugin, CLion provides extensive support for Rust. In addition to basic features, it also offers a complete debugger, CPU Profiler, and Valgrind memory checks for Rust.

Eclipse IDE’s Rust Plugin: Eclipse Corrosion

Can Rust Succeed? IDEs for Rust Development in 2021

Eclipse Corrosion is the Rust version of Eclipse IDE, essentially a Rust plugin for Eclipse IDE that provides rich development and debugging features through integration with the Rust language server and Cargo. It can be downloaded as a complete Eclipse package.

In addition to the features provided by the Rust language server, Corrosion also helps users better debug Rust programs, such as providing variable viewing, GDB console, and breakpoints. On the other hand, being based on Eclipse, it also supports features like project outlines, dark themes, issue viewing, and Git integration, making it easy for Eclipse users to adapt.

Vim’s Rust Plugin: rust.vim

The official Rust team has implemented a Vim plugin called rust.vim, which developers can use to configure their Rust development environment in Vim. rust.vim provides features such as Rust file detection, syntax highlighting, formatting, and integration with the syntax checking tool Syntastic. Features include:

  • Syntastic error checking: rust.vim automatically registers cargo as the syntax checker with Syntastic by default.

  • Integrates Tagbar to view source code

  • rustfmt code formatting: If rustfmt is installed, you can use the :RustFmt command to format code.

  • Playpen integration: The :RustPlay command sends the currently selected content to the Rust playpen; if nothing is selected, it sends the current buffer to the Rust playpen.

  • Testing: In cargo projects, the :RustTest command will run tests immediately.

Developers abroad have also compiled a more comprehensive overview of IDEs and plugins that support Rust, and it is kept updated in real-time:

Can Rust Succeed? IDEs for Rust Development in 2021

For more details, visit: https://areweideyet.com

Can Rust Succeed? IDEs for Rust Development in 2021

Have you seen the news broadcast by the “Mona Lisa”?

2021-03-13

Can Rust Succeed? IDEs for Rust Development in 2021

The 2020 GO Developer Survey Report is out: Satisfaction with GO language reaches 92%

2021-03-13

Can Rust Succeed? IDEs for Rust Development in 2021

After GitHub, GitLab also changed the default branch name from master to main

2021-03-13

Can Rust Succeed? IDEs for Rust Development in 2021

Can Rust Succeed? IDEs for Rust Development in 2021

Can Rust Succeed? IDEs for Rust Development in 2021If you find it good, please give us a thumbs up!

Leave a Comment