Name: rls-vscode
Owner: rust-lang-nursery
Description: RLS-based plugin for VSCode
Created: 2016-09-02 22:57:33.0
Updated: 2018-01-17 22:53:11.0
Pushed: 2018-01-17 20:36:21.0
Size: 290
Language: TypeScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
impl period has been started! Join us at Gitter.im.
Adds language support for Rust to Visual Studio Code. Supports:
Rust support is powered by the Rust Language Server (RLS). If you don't have it installed, the extension will install the RLS for you.
This extension is built and maintained by the RLS team, part of the Rust Developer Tools team. It is the reference client implementation for the RLS. Our focus is on providing a stable, high quality extension that makes best use of the RLS. We aim to support as many features as possible, but our priority is supporting the essential features as well as possible.
For support, please file an issue on the repo or talk to us in #rust-dev-tools on IRC (Mozilla servers). There is also some troubleshooting and debugging advice.
Contributing code, tests, documentation, and bug reports is appreciated! For more details on building and debugging, etc., see contributing.md.
ext install rust
at the command palette).File > Open Folder...
). Open the folder for the whole
project (i.e., the folder containing 'Cargo.toml'), not the 'src' folder.This extension provides some options into VSCode's configuration settings. These
options have names which start with rust.
. You can find the settings under
File > Preferences > Settings
, they all have Intellisense help.
Some highlights:
rust.show_warnings
- set to false to silence warnings in the editor.rust.build_lib
- if you have both a binary and library in your crate, set to
true to build the library.rust.build_bin
- if you have multiple binaries, you can specify which to build
using this option.rust.cfg_test
- build and index test code (i.e., code with #[cfg(test)]
/#[test]
)rust.workspace_mode
- experimental cargo workspace support. Note that using
this feature will slow down builds significantly and may be broken in
surprising and undocumented ways.Commands can be found in the command palette (ctrl + shift + p). We provide the following commands:
Find Implementations
- Find locations of impl
blocks for traits, structs, and enums.
Usefull to find all structs implementing a specific trait or all traits implemented for a struct.
Select a type when running the command.Snippets are code templates which expand into common boilerplate. Intellisense includes snippet names as options when you type; select one by pressing 'enter'. You can move to the next 'hole' in the template by pressing 'tab'. We provide the following snippets:
for
- a for loopunimplemented
unreachable
println
macro_rules
- declare a macroif let Option
- an if let
statement for executing code only in the Some
case.spawn
- spawn a threadThe plugin provides tasks for building, running, and testing using the relevant
cargo commands. You can build using ctrl + shift + b
. Access other tasks via
Run tasks
in the command palette.
The plugin writes these into tasks.json
. The plugin will not overwrite
existing tasks, so you can customise these tasks. To refresh back to the
defaults, delete tasks.json
and restart VSCode.
To enable formatting on save, you need to set the editor.formatOnSave
setting
to true
. Find it under File > Preferences > Settings
.
rls-preview
), rust-src
, and rust-analysis
components (the extension will install these
for you, with permission).This extension almost exclusively uses the RLS for its feature support (syntax highlighting, snippets, and build tasks are provided client-side). The RLS uses the Rust compiler (rustc) to get data about Rust programs. It uses Cargo to manage building. Both Cargo and rustc are run in-process by the RLS. Formatting and code completion are provided by rustfmt and Racer, again both of these are run in-process by the RLS.