1
1
# Rust support for Visual Studio Code
2
2
3
3
[ ![ ] ( https://vsmarketplacebadge.apphb.com/version/rust-lang.rust.svg )] ( https://marketplace.visualstudio.com/items?itemName=rust-lang.rust )
4
- [ ![ Build Status] ( https://travis-ci.com/rust-lang /rls-vscode.svg?branch=master )] ( https://travis-ci.com/rust-lang /rls-vscode )
4
+ [ ![ Build Status] ( https://travis-ci.com/AndriesK /rls-vscode.svg?branch=master )] ( https://travis-ci.com/AndriesK /rls-vscode )
5
5
6
6
Adds language support for Rust to Visual Studio Code. Supports:
7
7
8
- * code completion
9
- * jump to definition, peek definition, find all references, symbol search
10
- * types and documentation on hover
11
- * code formatting
12
- * refactoring (rename, deglob)
13
- * error squiggles and apply suggestions from errors
14
- * snippets
15
- * build tasks
16
-
8
+ - code completion
9
+ - jump to definition, peek definition, find all references, symbol search
10
+ - types and documentation on hover
11
+ - code formatting
12
+ - refactoring (rename, deglob)
13
+ - error squiggles and apply suggestions from errors
14
+ - snippets
15
+ - build tasks
17
16
18
17
Rust support is powered by the [ Rust Language Server] ( https://github.com/rust-lang/rls )
19
18
(RLS). If you don't have it installed, the extension will install it for you.
@@ -33,20 +32,18 @@ advice.
33
32
Contributing code, tests, documentation, and bug reports is appreciated! For
34
33
more details on building and debugging, etc., see [ contributing.md] ( contributing.md ) .
35
34
36
-
37
35
## Quick start
38
36
39
- * Install [ rustup] ( https://www.rustup.rs/ ) (Rust toolchain manager).
40
- * Install this extension from [ the VSCode Marketplace] ( https://marketplace.visualstudio.com/items?itemName=rust-lang.rust )
37
+ - Install [ rustup] ( https://www.rustup.rs/ ) (Rust toolchain manager).
38
+ - Install this extension from [ the VSCode Marketplace] ( https://marketplace.visualstudio.com/items?itemName=rust-lang.rust )
41
39
(or by entering ` ext install rust-lang.rust ` at the command palette <kbd >Ctrl</kbd >+<kbd >P</kbd >).
42
- * (Skip this step if you already have Rust projects that you'd like to work on.)
40
+ - (Skip this step if you already have Rust projects that you'd like to work on.)
43
41
Create a new Rust project by following [ these instructions] ( https://doc.rust-lang.org/book/ch01-03-hello-cargo.html ) .
44
- * Open a Rust project (` File > Add Folder to Workspace... ` ). Open the folder for the whole
42
+ - Open a Rust project (` File > Add Folder to Workspace... ` ). Open the folder for the whole
45
43
project (i.e., the folder containing 'Cargo.toml'), not the 'src' folder.
46
- * You'll be prompted to install the RLS. Once installed, the RLS should start
44
+ - You'll be prompted to install the RLS. Once installed, the RLS should start
47
45
building your project.
48
46
49
-
50
47
## Configuration
51
48
52
49
This extension provides options in VSCode's configuration settings. These
@@ -57,11 +54,11 @@ have Intellisense help.
57
54
58
55
Some highlights:
59
56
60
- * ` rust.show_warnings ` - set to false to silence warnings in the editor.
61
- * ` rust.all_targets ` - build and index code for all targets (i.e., integration tests, examples, and benches)
62
- * ` rust.cfg_test ` - build and index test code (i.e., code with ` #[cfg(test)] ` /` #[test] ` )
57
+ - ` rust.show_warnings ` - set to false to silence warnings in the editor.
58
+ - ` rust.all_targets ` - build and index code for all targets (i.e., integration tests, examples, and benches)
59
+ - ` rust.cfg_test ` - build and index test code (i.e., code with ` #[cfg(test)] ` /` #[test] ` )
63
60
64
- * ` rust-client.channel ` - specifies from which toolchain the RLS should be spawned
61
+ - ` rust-client.channel ` - specifies from which toolchain the RLS should be spawned
65
62
66
63
## Features
67
64
@@ -72,16 +69,16 @@ includes snippet names as options when you type; select one by pressing 'enter'.
72
69
You can move to the next 'hole' in the template by pressing 'tab'. We provide
73
70
the following snippets:
74
71
75
- * ` for ` - a for loop
76
- * ` unimplemented `
77
- * ` unreachable `
78
- * ` print(ln) `
79
- * ` assert(_eq) `
80
- * ` macro_rules ` - declare a macro
81
- * ` if let Option ` - an ` if let ` statement for executing code only in the ` Some `
72
+ - ` for ` - a for loop
73
+ - ` unimplemented `
74
+ - ` unreachable `
75
+ - ` print(ln) `
76
+ - ` assert(_eq) `
77
+ - ` macro_rules ` - declare a macro
78
+ - ` if let Option ` - an ` if let ` statement for executing code only in the ` Some `
82
79
case.
83
- * ` spawn ` - spawn a thread
84
- * ` extern crate ` - insert an ` extern crate ` statement
80
+ - ` spawn ` - spawn a thread
81
+ - ` extern crate ` - insert an ` extern crate ` statement
85
82
86
83
This extension is deliberately conservative about snippets and doesn't include
87
84
too many. If you want more, check out
@@ -97,22 +94,19 @@ The plugin writes these into `tasks.json`. The plugin will not overwrite
97
94
existing tasks, so you can customise these tasks. To refresh back to the
98
95
defaults, delete ` tasks.json ` and restart VSCode.
99
96
100
-
101
97
## Format on save
102
98
103
99
To enable formatting on save, you need to set the ` editor.formatOnSave ` setting
104
100
to ` true ` . Find it under ` File > Preferences > Settings ` .
105
101
106
-
107
102
## Requirements
108
103
109
- * [ Rustup] ( https://www.rustup.rs/ ) ,
110
- * A Rust toolchain (the extension will configure this for you, with
104
+ - [ Rustup] ( https://www.rustup.rs/ ) ,
105
+ - A Rust toolchain (the extension will configure this for you, with
111
106
permission),
112
- * ` rls ` , ` rust-src ` , and ` rust-analysis ` components (the
107
+ - ` rls ` , ` rust-src ` , and ` rust-analysis ` components (the
113
108
extension will install these for you, with permission).
114
109
115
-
116
110
## Implementation
117
111
118
112
This extension almost exclusively uses the RLS for its feature support (syntax
@@ -121,4 +115,3 @@ the Rust compiler (`rustc`) to get data about Rust programs. It uses Cargo to
121
115
manage building. Both Cargo and ` rustc ` are run in-process by the RLS. Formatting
122
116
and code completion are provided by ` rustfmt ` and Racer, again both of these are
123
117
run in-process by the RLS.
124
-
0 commit comments