diff options
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 30 | ||||
-rw-r--r-- | crates/rust-analyzer/src/main_loop/handlers.rs | 10 | ||||
-rw-r--r-- | editors/code/src/commands/runnables.ts | 2 |
3 files changed, 22 insertions, 20 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index b99b95bfc..2038ef89b 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs | |||
@@ -244,35 +244,35 @@ impl Config { | |||
244 | pub fn update_caps(&mut self, caps: &ClientCapabilities) { | 244 | pub fn update_caps(&mut self, caps: &ClientCapabilities) { |
245 | if let Some(doc_caps) = caps.text_document.as_ref() { | 245 | if let Some(doc_caps) = caps.text_document.as_ref() { |
246 | if let Some(value) = doc_caps.definition.as_ref().and_then(|it| it.link_support) { | 246 | if let Some(value) = doc_caps.definition.as_ref().and_then(|it| it.link_support) { |
247 | self.client_caps.location_link = value; | 247 | self.client_caps.location_link = value; |
248 | } | 248 | } |
249 | if let Some(value) = doc_caps.folding_range.as_ref().and_then(|it| it.line_folding_only) | 249 | if let Some(value) = doc_caps.folding_range.as_ref().and_then(|it| it.line_folding_only) |
250 | { | 250 | { |
251 | self.client_caps.line_folding_only = value | 251 | self.client_caps.line_folding_only = value |
252 | } | 252 | } |
253 | if let Some(value) = doc_caps | 253 | if let Some(value) = doc_caps |
254 | .document_symbol | 254 | .document_symbol |
255 | .as_ref() | 255 | .as_ref() |
256 | .and_then(|it| it.hierarchical_document_symbol_support) | 256 | .and_then(|it| it.hierarchical_document_symbol_support) |
257 | { | 257 | { |
258 | self.client_caps.hierarchical_symbols = value | 258 | self.client_caps.hierarchical_symbols = value |
259 | } | 259 | } |
260 | if let Some(value) = doc_caps | 260 | if let Some(value) = doc_caps |
261 | .code_action | 261 | .code_action |
262 | .as_ref() | 262 | .as_ref() |
263 | .and_then(|it| Some(it.code_action_literal_support.is_some())) | 263 | .and_then(|it| Some(it.code_action_literal_support.is_some())) |
264 | { | 264 | { |
265 | self.client_caps.code_action_literals = value; | 265 | self.client_caps.code_action_literals = value; |
266 | } | 266 | } |
267 | self.completion.allow_snippets(false); | 267 | self.completion.allow_snippets(false); |
268 | if let Some(completion) = &doc_caps.completion { | 268 | if let Some(completion) = &doc_caps.completion { |
269 | if let Some(completion_item) = &completion.completion_item { | 269 | if let Some(completion_item) = &completion.completion_item { |
270 | if let Some(value) = completion_item.snippet_support { | 270 | if let Some(value) = completion_item.snippet_support { |
271 | self.completion.allow_snippets(value); | 271 | self.completion.allow_snippets(value); |
272 | } | ||
272 | } | 273 | } |
273 | } | 274 | } |
274 | } | 275 | } |
275 | } | ||
276 | 276 | ||
277 | if let Some(window_caps) = caps.window.as_ref() { | 277 | if let Some(window_caps) = caps.window.as_ref() { |
278 | if let Some(value) = window_caps.work_done_progress { | 278 | if let Some(value) = window_caps.work_done_progress { |
diff --git a/crates/rust-analyzer/src/main_loop/handlers.rs b/crates/rust-analyzer/src/main_loop/handlers.rs index 808532d23..e67556752 100644 --- a/crates/rust-analyzer/src/main_loop/handlers.rs +++ b/crates/rust-analyzer/src/main_loop/handlers.rs | |||
@@ -826,16 +826,18 @@ pub fn handle_code_lens( | |||
826 | if world.config.lens.runnable() { | 826 | if world.config.lens.runnable() { |
827 | // Gather runnables | 827 | // Gather runnables |
828 | for runnable in world.analysis().runnables(file_id)? { | 828 | for runnable in world.analysis().runnables(file_id)? { |
829 | let (run_title, debugee ) = match &runnable.kind { | 829 | let (run_title, debugee) = match &runnable.kind { |
830 | RunnableKind::Test { .. } | RunnableKind::TestMod { .. } => ("▶️\u{fe0e}Run Test", true), | 830 | RunnableKind::Test { .. } | RunnableKind::TestMod { .. } => { |
831 | RunnableKind::DocTest { .. } => { | 831 | ("▶️\u{fe0e}Run Test", true) |
832 | } | ||
833 | RunnableKind::DocTest { .. } => { | ||
832 | // cargo does not support -no-run for doctests | 834 | // cargo does not support -no-run for doctests |
833 | ("▶️\u{fe0e}Run Doctest", false) | 835 | ("▶️\u{fe0e}Run Doctest", false) |
834 | } | 836 | } |
835 | RunnableKind::Bench { .. } => { | 837 | RunnableKind::Bench { .. } => { |
836 | // Nothing wrong with bench debugging | 838 | // Nothing wrong with bench debugging |
837 | ("Run Bench", true) | 839 | ("Run Bench", true) |
838 | }, | 840 | } |
839 | RunnableKind::Bin => { | 841 | RunnableKind::Bin => { |
840 | // Do not suggest binary run on other target than binary | 842 | // Do not suggest binary run on other target than binary |
841 | match &cargo_spec { | 843 | match &cargo_spec { |
diff --git a/editors/code/src/commands/runnables.ts b/editors/code/src/commands/runnables.ts index a408021e7..0bd30fb07 100644 --- a/editors/code/src/commands/runnables.ts +++ b/editors/code/src/commands/runnables.ts | |||
@@ -40,7 +40,7 @@ async function selectRunnable(ctx: Ctx, prevRunnable?: RunnableQuickPick, debugg | |||
40 | items.push(new RunnableQuickPick(r)); | 40 | items.push(new RunnableQuickPick(r)); |
41 | } | 41 | } |
42 | 42 | ||
43 | if( items.length === 0 ) { | 43 | if (items.length === 0) { |
44 | // it is the debug case, run always has at least 'cargo check ...' | 44 | // it is the debug case, run always has at least 'cargo check ...' |
45 | // see crates\rust-analyzer\src\main_loop\handlers.rs, handle_runnables | 45 | // see crates\rust-analyzer\src\main_loop\handlers.rs, handle_runnables |
46 | vscode.window.showErrorMessage("There's no debug target!"); | 46 | vscode.window.showErrorMessage("There's no debug target!"); |