aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/rust-analyzer/src/config.rs4
-rw-r--r--crates/rust-analyzer/src/main_loop/handlers.rs30
-rw-r--r--editors/code/src/commands/runnables.ts4
3 files changed, 18 insertions, 20 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index 07fb8f16a..f3d8773cc 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -19,8 +19,6 @@ pub struct Config {
19 19
20 pub with_sysroot: bool, 20 pub with_sysroot: bool,
21 pub publish_diagnostics: bool, 21 pub publish_diagnostics: bool,
22 // TODO: move to experimental capabilities
23 pub vscode_lldb: bool,
24 pub lru_capacity: Option<usize>, 22 pub lru_capacity: Option<usize>,
25 pub proc_macro_srv: Option<String>, 23 pub proc_macro_srv: Option<String>,
26 pub files: FilesConfig, 24 pub files: FilesConfig,
@@ -78,7 +76,6 @@ impl Default for Config {
78 76
79 with_sysroot: true, 77 with_sysroot: true,
80 publish_diagnostics: true, 78 publish_diagnostics: true,
81 vscode_lldb: false,
82 lru_capacity: None, 79 lru_capacity: None,
83 proc_macro_srv: None, 80 proc_macro_srv: None,
84 files: FilesConfig { watcher: FilesWatcher::Notify, exclude: Vec::new() }, 81 files: FilesConfig { watcher: FilesWatcher::Notify, exclude: Vec::new() },
@@ -122,7 +119,6 @@ impl Config {
122 119
123 set(value, "/withSysroot", &mut self.with_sysroot); 120 set(value, "/withSysroot", &mut self.with_sysroot);
124 set(value, "/featureFlags/lsp.diagnostics", &mut self.publish_diagnostics); 121 set(value, "/featureFlags/lsp.diagnostics", &mut self.publish_diagnostics);
125 set(value, "/vscodeLldb", &mut self.vscode_lldb);
126 set(value, "/lruCapacity", &mut self.lru_capacity); 122 set(value, "/lruCapacity", &mut self.lru_capacity);
127 if let Some(watcher) = get::<String>(value, "/files/watcher") { 123 if let Some(watcher) = get::<String>(value, "/files/watcher") {
128 self.files.watcher = match watcher.as_str() { 124 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 db620dca3..b207f0764 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(
810 }; 810 };
811 lenses.push(lens); 811 lenses.push(lens);
812 812
813 if world.config.vscode_lldb { 813 if r.args[0] == "run" {
814 if r.args[0] == "run" { 814 r.args[0] = "build".into();
815 r.args[0] = "build".into(); 815 } else {
816 } else { 816 r.args.push("--no-run".into());
817 r.args.push("--no-run".into());
818 }
819 let debug_lens = CodeLens {
820 range: r.range,
821 command: Some(Command {
822 title: "Debug".into(),
823 command: "rust-analyzer.debugSingle".into(),
824 arguments: Some(vec![to_value(r).unwrap()]),
825 }),
826 data: None,
827 };
828 lenses.push(debug_lens);
829 } 817 }
818 let debug_lens = CodeLens {
819 range: r.range,
820 command: Some(Command {
821 title: "Debug".into(),
822 command: "rust-analyzer.debugSingle".into(),
823 arguments: Some(vec![to_value(r).unwrap()]),
824 }),
825 data: None,
826 };
827 lenses.push(debug_lens);
830 } 828 }
831 829
832 // Handle impls 830 // Handle impls
diff --git a/editors/code/src/commands/runnables.ts b/editors/code/src/commands/runnables.ts
index 357155163..2635a1440 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 {
66 return async (config: ra.Runnable) => { 66 return async (config: ra.Runnable) => {
67 const editor = ctx.activeRustEditor; 67 const editor = ctx.activeRustEditor;
68 if (!editor) return; 68 if (!editor) return;
69 if (!vscode.extensions.getExtension("vadimcn.vscode-lldb")) {
70 vscode.window.showErrorMessage("Install `vadimcn.vscode-lldb` extension for debugging");
71 return;
72 }
69 73
70 const debugConfig = { 74 const debugConfig = {
71 type: "lldb", 75 type: "lldb",