From 7a4ebd2c8dfee8ca15dab7ba053a6521840aa5e3 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 2 Apr 2020 12:56:14 +0200 Subject: [PATCH] Remove vscode_lldb setting --- crates/rust-analyzer/src/config.rs | 4 --- .../rust-analyzer/src/main_loop/handlers.rs | 30 +++++++++---------- editors/code/src/commands/runnables.ts | 4 +++ 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 07fb8f16a34..f3d8773cc11 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs @@ -19,8 +19,6 @@ pub struct Config { pub with_sysroot: bool, pub publish_diagnostics: bool, - // TODO: move to experimental capabilities - pub vscode_lldb: bool, pub lru_capacity: Option, pub proc_macro_srv: Option, pub files: FilesConfig, @@ -78,7 +76,6 @@ fn default() -> Self { with_sysroot: true, publish_diagnostics: true, - vscode_lldb: false, lru_capacity: None, proc_macro_srv: None, files: FilesConfig { watcher: FilesWatcher::Notify, exclude: Vec::new() }, @@ -122,7 +119,6 @@ pub fn update(&mut self, value: &serde_json::Value) { set(value, "/withSysroot", &mut self.with_sysroot); set(value, "/featureFlags/lsp.diagnostics", &mut self.publish_diagnostics); - set(value, "/vscodeLldb", &mut self.vscode_lldb); set(value, "/lruCapacity", &mut self.lru_capacity); if let Some(watcher) = get::(value, "/files/watcher") { self.files.watcher = match watcher.as_str() { diff --git a/crates/rust-analyzer/src/main_loop/handlers.rs b/crates/rust-analyzer/src/main_loop/handlers.rs index db620dca30a..b207f0764cd 100644 --- a/crates/rust-analyzer/src/main_loop/handlers.rs +++ b/crates/rust-analyzer/src/main_loop/handlers.rs @@ -810,23 +810,21 @@ pub fn handle_code_lens( }; lenses.push(lens); - if world.config.vscode_lldb { - if r.args[0] == "run" { - r.args[0] = "build".into(); - } else { - r.args.push("--no-run".into()); - } - let debug_lens = CodeLens { - range: r.range, - command: Some(Command { - title: "Debug".into(), - command: "rust-analyzer.debugSingle".into(), - arguments: Some(vec![to_value(r).unwrap()]), - }), - data: None, - }; - lenses.push(debug_lens); + if r.args[0] == "run" { + r.args[0] = "build".into(); + } else { + r.args.push("--no-run".into()); } + let debug_lens = CodeLens { + range: r.range, + command: Some(Command { + title: "Debug".into(), + command: "rust-analyzer.debugSingle".into(), + arguments: Some(vec![to_value(r).unwrap()]), + }), + data: None, + }; + lenses.push(debug_lens); } // Handle impls diff --git a/editors/code/src/commands/runnables.ts b/editors/code/src/commands/runnables.ts index 357155163d7..2635a144086 100644 --- a/editors/code/src/commands/runnables.ts +++ b/editors/code/src/commands/runnables.ts @@ -66,6 +66,10 @@ export function debugSingle(ctx: Ctx): Cmd { return async (config: ra.Runnable) => { const editor = ctx.activeRustEditor; if (!editor) return; + if (!vscode.extensions.getExtension("vadimcn.vscode-lldb")) { + vscode.window.showErrorMessage("Install `vadimcn.vscode-lldb` extension for debugging"); + return; + } const debugConfig = { type: "lldb",