Rust, Software Development

Rust IDE Plugin For Visual Studio Code – Install And Use

Have you been looking for a Rust IDE? Unfortunately, there are no IDEs specifically written for Rust. There are, however, Rust IDE plugins (or extensions) for IntelliJ IDEA and Visual Studio Code IDE. This post shows how to install and use the Rust IDE plugin for Visual Studio code.

Requirements

For this post, we use the following items.

  1. Visual Studio Code 1.48.2 for 64-bit architecture
  2. Rust 0.7.8 extension for Visual Studio Code IDE
  3. Rust 1.46.0 (For installation, please see How to install Rust on Windows 10)
  4. Windows 10

Download And Extract Visual Studio Code

Go to https://code.visualstudio.com/ and download a zip distribution of Visual Studio Code IDE.

From the Download page, choose a 64-bit zip distribution.

 

Then, extract the zip file to some local folder. To start up the Visual Studio Code IDE, please double-click the Code.exe file.

Install Visual Studio Code IDE Plugins or Extensions

Next, we need to install a Visual Studio Code IDE extension. Click the Extensions icon on the left side of the IDE main window, as shown below.

Search for “rust” and choose the Rust extension. Then, click the Install button. 

Next, open an existing Rust project ( File > Add Folder to Workspace...). Open the folder for the whole project that contains the Cargo. toml file. Finally, Visual Studio Code IDE will prompt you to install the Rust server. Once installed, it should start analyzing your project (RLS will also have to build the project).

For the Rust project, we can use codes from Rust Stable And Rocket 0.5 Latest Development Codes.

Run Rust Application

Running Rust application in Visual Studio Code IDE is straight forward. Go to Terminal > New Terminal or press Ctrl+Shift+` to open a terminal within the IDE, as shown below.

On the terminal, run the following command.

Then, we get the following output.

We can also run other Cargo commands.

Testing Rust Application

At this point, our Rocket application is up and running. We can verify it by accessing the URL shown below.

This post is part of the Rust Programming Language For Beginners Tutorial.

You Might Also Like