@@ -14,37 +14,41 @@ Adds language support for Rust to Visual Studio Code. Supports:
14
14
* snippets
15
15
* build tasks
16
16
17
+ Rust support is powered by a separate [ language server] ( https://microsoft.github.io/language-server-protocol/overviews/lsp/overview/ )
18
+ - either by the official [ Rust Language Server] ( https://github.com/rust-lang/rls ) (RLS) or
19
+ [ rust-analyzer] ( https://github.com/rust-lang/rls ) , depending on the user's
20
+ preference. If you don't have it installed, the extension will install it for
21
+ you (with permission).
17
22
18
- Rust support is powered by the [ Rust Language Server] ( https://github.com/rust-lang/rls )
19
- (RLS). If you don't have it installed, the extension will install it for you.
20
-
21
- This extension is built and maintained by the RLS team, part of the Rust
23
+ This extension is built and maintained by the Rust
22
24
[ IDEs and editors team] ( https://www.rust-lang.org/en-US/team.html#Dev-tools-team ) .
23
- It is the reference client implementation for the RLS. Our focus is on providing
24
- a stable, high quality extension that makes best use of the RLS. We aim to
25
- support as many features as possible, but our priority is supporting the
26
- essential features as well as possible.
25
+ Our focus is on providing
26
+ a stable, high quality extension that makes the best use of the respective language
27
+ server. We aim to support as many features as possible, but our priority is
28
+ supporting the essential features as well as possible.
29
+
30
+ For support, please file an
31
+ [ issue on the repo] ( https://github.com/rust-lang/rls-vscode/issues/new )
32
+ or talk to us [ on Discord] ( https://discordapp.com/invite/rust-lang ) .
33
+ For RLS, there is also some [ troubleshooting and debugging] ( https://github.com/rust-lang/rls/blob/master/debugging.md ) advice.
27
34
28
- For support, please file an [ issue on the repo] ( https://github.com/rust-lang/rls-vscode/issues/new )
29
- or talk to us [ on Discord] ( https://discordapp.com/invite/rust-lang ) . There is also some
30
- [ troubleshooting and debugging] ( https://github.com/rust-lang/rls/blob/master/debugging.md )
31
- advice.
35
+ ## Contribution
32
36
33
37
Contributing code, tests, documentation, and bug reports is appreciated! For
34
- more details on building and debugging, etc., see [ contributing.md] ( contributing.md ) .
38
+ more details see [ contributing.md] ( contributing.md ) .
35
39
36
40
37
41
## Quick start
38
42
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 )
43
+ 1 . Install [ rustup] ( https://www.rustup.rs/ ) (Rust toolchain manager).
44
+ 2 . Install this extension from [ the VSCode Marketplace] ( https://marketplace.visualstudio.com/items?itemName=rust-lang.rust )
41
45
(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.)
46
+ 3 . (Skip this step if you already have Rust projects that you'd like to work on.)
43
47
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
45
- 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
47
- building your project.
48
+ 4 . Open a Rust project (` File > Add Folder to Workspace... ` ). Open the folder for the whole
49
+ project (i.e., the folder containing ` Cargo.toml ` , not the ` src ` folder) .
50
+ 5 . You'll be prompted to install the Rust server . Once installed, it should start
51
+ analyzing your project (RLS will also have to to build the project) .
48
52
49
53
50
54
## Configuration
@@ -53,24 +57,25 @@ This extension provides options in VSCode's configuration settings. These
53
57
include ` rust.* ` , which are passed directly to RLS, and the ` rust-client.* `
54
58
, which mostly deal with how to spawn it or debug it.
55
59
You can find the settings under ` File > Preferences > Settings ` ; they all
56
- have Intellisense help.
60
+ have IntelliSense help.
57
61
58
- Some highlights :
62
+ Examples :
59
63
60
64
* ` rust.show_warnings ` - set to false to silence warnings in the editor.
61
65
* ` rust.all_targets ` - build and index code for all targets (i.e., integration tests, examples, and benches)
62
66
* ` rust.cfg_test ` - build and index test code (i.e., code with ` #[cfg(test)] ` /` #[test] ` )
63
-
64
67
* ` rust-client.channel ` - specifies from which toolchain the RLS should be spawned
65
68
69
+ > ** _ TIP:_ ** To select the underlying language server, set ` rust-client.engine ` accordingly!
70
+
66
71
## Features
67
72
68
73
### Snippets
69
74
70
- Snippets are code templates which expand into common boilerplate. Intellisense
71
- includes snippet names as options when you type; select one by pressing 'enter'.
72
- You can move to the next 'hole' in the template by pressing 'tab'. We provide
73
- the following snippets:
75
+ Snippets are code templates which expand into common boilerplate. IntelliSense
76
+ includes snippet names as options when you type; select one by pressing
77
+ < kbd >enter</ kbd >. You can move to the next snippet 'hole' in the template by
78
+ pressing < kbd >tab</ kbd >. We provide the following snippets:
74
79
75
80
* ` for ` - a for loop
76
81
* ` macro_rules ` - declare a macro
@@ -102,18 +107,25 @@ to `true`. Find it under `File > Preferences > Settings`.
102
107
## Requirements
103
108
104
109
* [ Rustup] ( https://www.rustup.rs/ ) ,
105
- * A Rust toolchain (the extension will configure this for you, with
106
- permission),
107
- * ` rls ` , ` rust-src ` , and ` rust-analysis ` components (the
108
- extension will install these for you, with permission) .
110
+ * A Rust toolchain (the extension will configure this for you, with permission),
111
+ * ` rls ` , ` rust-src ` , and ` rust-analysis ` components (the extension will install
112
+ these for you, with permission). Only ` rust-src ` is required when using
113
+ rust-analyzer .
109
114
110
115
111
116
## Implementation
112
117
113
- This extension almost exclusively uses the RLS for its feature support (syntax
114
- highlighting, snippets, and build tasks are provided client-side). The RLS uses
115
- the Rust compiler (` rustc ` ) to get data about Rust programs. It uses Cargo to
116
- manage building. Both Cargo and ` rustc ` are run in-process by the RLS. Formatting
117
- and code completion are provided by ` rustfmt ` and Racer, again both of these are
118
- run in-process by the RLS.
118
+ Both language servers can use Cargo to get more information about Rust projects
119
+ and both use [ ` rustfmt ` ] ( https://github.com/rust-lang/rustfmt/ ) extensively to
120
+ format the code.
121
+
122
+ [ RLS] ( https://github.com/rust-lang/rls ) uses Cargo and also the Rust compiler
123
+ ([ ` rustc ` ] ( https://github.com/rust-lang/rust/ ) ) in a more direct fashion, where
124
+ it builds the project and reuses the data computed by the compiler itself. To
125
+ provide code completion it uses a separate tool called
126
+ [ ` racer ` ] ( https://github.com/racer-rust/racer ) .
119
127
128
+ [ Rust Analyzer] ( https://github.com/rust-analyzer/rust-analyzer ) is a separate
129
+ compiler frontend for the Rust language that doesn't use the Rust compiler
130
+ ([ ` rustc ` ] ( https://github.com/rust-lang/rust/ ) ) directly but rather performs its
131
+ own analysis that's tailor-fitted to the editor/IDE use case.
0 commit comments