diff options
-rw-r--r-- | crates/ra_parser/src/grammar/expressions.rs | 3 | ||||
-rw-r--r-- | crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rs | 1 | ||||
-rw-r--r-- | crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.txt | 41 | ||||
-rw-r--r-- | editors/code/package.json | 29 | ||||
-rw-r--r-- | editors/code/src/inlay_hints.ts | 2 |
5 files changed, 62 insertions, 14 deletions
diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs index 06c92645e..4163a2cf5 100644 --- a/crates/ra_parser/src/grammar/expressions.rs +++ b/crates/ra_parser/src/grammar/expressions.rs | |||
@@ -169,6 +169,7 @@ pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi) { | |||
169 | // let d: i32 = 92; | 169 | // let d: i32 = 92; |
170 | // let e: !; | 170 | // let e: !; |
171 | // let _: ! = {}; | 171 | // let _: ! = {}; |
172 | // let f = #[attr]||{}; | ||
172 | // } | 173 | // } |
173 | fn let_stmt(p: &mut Parser, m: Marker, with_semi: StmtWithSemi) { | 174 | fn let_stmt(p: &mut Parser, m: Marker, with_semi: StmtWithSemi) { |
174 | assert!(p.at(T![let])); | 175 | assert!(p.at(T![let])); |
@@ -178,7 +179,7 @@ pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi) { | |||
178 | types::ascription(p); | 179 | types::ascription(p); |
179 | } | 180 | } |
180 | if p.eat(T![=]) { | 181 | if p.eat(T![=]) { |
181 | expressions::expr(p); | 182 | expressions::expr_with_attrs(p); |
182 | } | 183 | } |
183 | 184 | ||
184 | match with_semi { | 185 | match with_semi { |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rs b/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rs index 86803fe08..fa8ee49a2 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rs | |||
@@ -5,4 +5,5 @@ fn foo() { | |||
5 | let d: i32 = 92; | 5 | let d: i32 = 92; |
6 | let e: !; | 6 | let e: !; |
7 | let _: ! = {}; | 7 | let _: ! = {}; |
8 | let f = #[attr]||{}; | ||
8 | } | 9 | } |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.txt b/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.txt index 97166cfd5..17739dfbd 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@[0; 110) | 1 | SOURCE_FILE@[0; 135) |
2 | FN_DEF@[0; 109) | 2 | FN_DEF@[0; 134) |
3 | FN_KW@[0; 2) "fn" | 3 | FN_KW@[0; 2) "fn" |
4 | WHITESPACE@[2; 3) " " | 4 | WHITESPACE@[2; 3) " " |
5 | NAME@[3; 6) | 5 | NAME@[3; 6) |
@@ -8,8 +8,8 @@ SOURCE_FILE@[0; 110) | |||
8 | L_PAREN@[6; 7) "(" | 8 | L_PAREN@[6; 7) "(" |
9 | R_PAREN@[7; 8) ")" | 9 | R_PAREN@[7; 8) ")" |
10 | WHITESPACE@[8; 9) " " | 10 | WHITESPACE@[8; 9) " " |
11 | BLOCK_EXPR@[9; 109) | 11 | BLOCK_EXPR@[9; 134) |
12 | BLOCK@[9; 109) | 12 | BLOCK@[9; 134) |
13 | L_CURLY@[9; 10) "{" | 13 | L_CURLY@[9; 10) "{" |
14 | WHITESPACE@[10; 15) "\n " | 14 | WHITESPACE@[10; 15) "\n " |
15 | LET_STMT@[15; 21) | 15 | LET_STMT@[15; 21) |
@@ -97,6 +97,33 @@ SOURCE_FILE@[0; 110) | |||
97 | L_CURLY@[104; 105) "{" | 97 | L_CURLY@[104; 105) "{" |
98 | R_CURLY@[105; 106) "}" | 98 | R_CURLY@[105; 106) "}" |
99 | SEMI@[106; 107) ";" | 99 | SEMI@[106; 107) ";" |
100 | WHITESPACE@[107; 108) "\n" | 100 | WHITESPACE@[107; 112) "\n " |
101 | R_CURLY@[108; 109) "}" | 101 | LET_STMT@[112; 132) |
102 | WHITESPACE@[109; 110) "\n" | 102 | LET_KW@[112; 115) "let" |
103 | WHITESPACE@[115; 116) " " | ||
104 | BIND_PAT@[116; 117) | ||
105 | NAME@[116; 117) | ||
106 | IDENT@[116; 117) "f" | ||
107 | WHITESPACE@[117; 118) " " | ||
108 | EQ@[118; 119) "=" | ||
109 | WHITESPACE@[119; 120) " " | ||
110 | LAMBDA_EXPR@[120; 131) | ||
111 | ATTR@[120; 127) | ||
112 | POUND@[120; 121) "#" | ||
113 | L_BRACK@[121; 122) "[" | ||
114 | PATH@[122; 126) | ||
115 | PATH_SEGMENT@[122; 126) | ||
116 | NAME_REF@[122; 126) | ||
117 | IDENT@[122; 126) "attr" | ||
118 | R_BRACK@[126; 127) "]" | ||
119 | PARAM_LIST@[127; 129) | ||
120 | PIPE@[127; 128) "|" | ||
121 | PIPE@[128; 129) "|" | ||
122 | BLOCK_EXPR@[129; 131) | ||
123 | BLOCK@[129; 131) | ||
124 | L_CURLY@[129; 130) "{" | ||
125 | R_CURLY@[130; 131) "}" | ||
126 | SEMI@[131; 132) ";" | ||
127 | WHITESPACE@[132; 133) "\n" | ||
128 | R_CURLY@[133; 134) "}" | ||
129 | WHITESPACE@[134; 135) "\n" | ||
diff --git a/editors/code/package.json b/editors/code/package.json index df8265be1..b013c3f4a 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -155,11 +155,6 @@ | |||
155 | "when": "editorTextFocus && editorLangId == rust" | 155 | "when": "editorTextFocus && editorLangId == rust" |
156 | }, | 156 | }, |
157 | { | 157 | { |
158 | "command": "rust-analyzer.run", | ||
159 | "key": "ctrl+r", | ||
160 | "when": "editorTextFocus && editorLangId == rust" | ||
161 | }, | ||
162 | { | ||
163 | "command": "rust-analyzer.onEnter", | 158 | "command": "rust-analyzer.onEnter", |
164 | "key": "enter", | 159 | "key": "enter", |
165 | "when": "editorTextFocus && !suggestWidgetVisible && editorLangId == rust && !vim.active || vim.mode == 'Insert' && editorTextFocus && !suggestWidgetVisible && editorLangId == rust" | 160 | "when": "editorTextFocus && !suggestWidgetVisible && editorLangId == rust && !vim.active || vim.mode == 'Insert' && editorTextFocus && !suggestWidgetVisible && editorLangId == rust" |
@@ -187,7 +182,29 @@ | |||
187 | "rust-analyzer.featureFlags": { | 182 | "rust-analyzer.featureFlags": { |
188 | "type": "object", | 183 | "type": "object", |
189 | "default": {}, | 184 | "default": {}, |
190 | "description": "Fine grained feature flags to disable annoying features" | 185 | "description": "Fine grained feature flags to disable annoying features", |
186 | "properties": { | ||
187 | "lsp.diagnostics": { | ||
188 | "type": "boolean", | ||
189 | "description": "Whether to show diagnostics from `cargo check`" | ||
190 | }, | ||
191 | "completion.insertion.add-call-parenthesis": { | ||
192 | "type": "boolean", | ||
193 | "description": "Whether to add parenthesis when completing functions" | ||
194 | }, | ||
195 | "completion.enable-postfix": { | ||
196 | "type": "boolean", | ||
197 | "description": "Whether to show postfix snippets like `dbg`, `if`, `not`, etc." | ||
198 | }, | ||
199 | "notifications.workspace-loaded": { | ||
200 | "type": "boolean", | ||
201 | "description": "Whether to show `workspace loaded` message" | ||
202 | }, | ||
203 | "notifications.cargo-toml-not-found": { | ||
204 | "type": "boolean", | ||
205 | "description": "Whether to show `can't find Cargo.toml` error message" | ||
206 | } | ||
207 | } | ||
191 | }, | 208 | }, |
192 | "rust-analyzer.serverPath": { | 209 | "rust-analyzer.serverPath": { |
193 | "type": [ | 210 | "type": [ |
diff --git a/editors/code/src/inlay_hints.ts b/editors/code/src/inlay_hints.ts index 5951cf1b4..6871bc111 100644 --- a/editors/code/src/inlay_hints.ts +++ b/editors/code/src/inlay_hints.ts | |||
@@ -42,12 +42,14 @@ export function activateInlayHints(ctx: Ctx) { | |||
42 | const typeHintDecorationType = vscode.window.createTextEditorDecorationType({ | 42 | const typeHintDecorationType = vscode.window.createTextEditorDecorationType({ |
43 | after: { | 43 | after: { |
44 | color: new vscode.ThemeColor('rust_analyzer.inlayHint'), | 44 | color: new vscode.ThemeColor('rust_analyzer.inlayHint'), |
45 | fontStyle: "normal", | ||
45 | }, | 46 | }, |
46 | }); | 47 | }); |
47 | 48 | ||
48 | const parameterHintDecorationType = vscode.window.createTextEditorDecorationType({ | 49 | const parameterHintDecorationType = vscode.window.createTextEditorDecorationType({ |
49 | before: { | 50 | before: { |
50 | color: new vscode.ThemeColor('rust_analyzer.inlayHint'), | 51 | color: new vscode.ThemeColor('rust_analyzer.inlayHint'), |
52 | fontStyle: "normal", | ||
51 | }, | 53 | }, |
52 | }); | 54 | }); |
53 | 55 | ||