diff options
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 4 | ||||
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 1 | ||||
-rw-r--r-- | crates/rust-analyzer/src/main_loop/handlers.rs | 34 | ||||
-rw-r--r-- | crates/rust-analyzer/src/world.rs | 1 | ||||
-rw-r--r-- | editors/code/package.json | 3 | ||||
-rw-r--r-- | editors/code/src/client.ts | 1 | ||||
-rw-r--r-- | editors/code/src/config.ts | 1 |
7 files changed, 26 insertions, 19 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index a8bf29ddf..cfca06f56 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs | |||
@@ -51,6 +51,9 @@ pub struct ServerConfig { | |||
51 | 51 | ||
52 | /// Cargo feature configurations. | 52 | /// Cargo feature configurations. |
53 | pub cargo_features: CargoFeatures, | 53 | pub cargo_features: CargoFeatures, |
54 | |||
55 | /// Enabled if the vscode_lldb extension is available. | ||
56 | pub vscode_lldb: bool, | ||
54 | } | 57 | } |
55 | 58 | ||
56 | impl Default for ServerConfig { | 59 | impl Default for ServerConfig { |
@@ -70,6 +73,7 @@ impl Default for ServerConfig { | |||
70 | additional_out_dirs: FxHashMap::default(), | 73 | additional_out_dirs: FxHashMap::default(), |
71 | cargo_features: Default::default(), | 74 | cargo_features: Default::default(), |
72 | rustfmt_args: Vec::new(), | 75 | rustfmt_args: Vec::new(), |
76 | vscode_lldb: false, | ||
73 | } | 77 | } |
74 | } | 78 | } |
75 | } | 79 | } |
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 4f7aac754..b4add046f 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -185,6 +185,7 @@ pub fn main_loop( | |||
185 | all_targets: config.cargo_watch_all_targets, | 185 | all_targets: config.cargo_watch_all_targets, |
186 | }, | 186 | }, |
187 | rustfmt_args: config.rustfmt_args, | 187 | rustfmt_args: config.rustfmt_args, |
188 | vscode_lldb: config.vscode_lldb, | ||
188 | } | 189 | } |
189 | }; | 190 | }; |
190 | 191 | ||
diff --git a/crates/rust-analyzer/src/main_loop/handlers.rs b/crates/rust-analyzer/src/main_loop/handlers.rs index f9715e675..571a896f3 100644 --- a/crates/rust-analyzer/src/main_loop/handlers.rs +++ b/crates/rust-analyzer/src/main_loop/handlers.rs | |||
@@ -805,23 +805,25 @@ pub fn handle_code_lens( | |||
805 | }), | 805 | }), |
806 | data: None, | 806 | data: None, |
807 | }; | 807 | }; |
808 | if r.args[0] == "run" { | ||
809 | r.args[0] = "build".into(); | ||
810 | } else { | ||
811 | r.args.push("--no-run".into()); | ||
812 | } | ||
813 | let debug_lens = CodeLens { | ||
814 | range: r.range, | ||
815 | command: Some(Command { | ||
816 | title: "Debug".into(), | ||
817 | command: "rust-analyzer.debugSingle".into(), | ||
818 | arguments: Some(vec![to_value(r).unwrap()]), | ||
819 | }), | ||
820 | data: None, | ||
821 | }; | ||
822 | |||
823 | lenses.push(lens); | 808 | lenses.push(lens); |
824 | lenses.push(debug_lens); | 809 | |
810 | if world.options.vscode_lldb { | ||
811 | if r.args[0] == "run" { | ||
812 | r.args[0] = "build".into(); | ||
813 | } else { | ||
814 | r.args.push("--no-run".into()); | ||
815 | } | ||
816 | let debug_lens = CodeLens { | ||
817 | range: r.range, | ||
818 | command: Some(Command { | ||
819 | title: "Debug".into(), | ||
820 | command: "rust-analyzer.debugSingle".into(), | ||
821 | arguments: Some(vec![to_value(r).unwrap()]), | ||
822 | }), | ||
823 | data: None, | ||
824 | }; | ||
825 | lenses.push(debug_lens); | ||
826 | } | ||
825 | } | 827 | } |
826 | 828 | ||
827 | // Handle impls | 829 | // Handle impls |
diff --git a/crates/rust-analyzer/src/world.rs b/crates/rust-analyzer/src/world.rs index 9ef368529..a4fda9f80 100644 --- a/crates/rust-analyzer/src/world.rs +++ b/crates/rust-analyzer/src/world.rs | |||
@@ -37,6 +37,7 @@ pub struct Options { | |||
37 | pub max_inlay_hint_length: Option<usize>, | 37 | pub max_inlay_hint_length: Option<usize>, |
38 | pub rustfmt_args: Vec<String>, | 38 | pub rustfmt_args: Vec<String>, |
39 | pub cargo_watch: CheckOptions, | 39 | pub cargo_watch: CheckOptions, |
40 | pub vscode_lldb: bool, | ||
40 | } | 41 | } |
41 | 42 | ||
42 | /// `WorldState` is the primary mutable state of the language server | 43 | /// `WorldState` is the primary mutable state of the language server |
diff --git a/editors/code/package.json b/editors/code/package.json index 744585721..1fe8e9f8a 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -51,9 +51,6 @@ | |||
51 | "typescript-formatter": "^7.2.2", | 51 | "typescript-formatter": "^7.2.2", |
52 | "vsce": "^1.74.0" | 52 | "vsce": "^1.74.0" |
53 | }, | 53 | }, |
54 | "extensionDependencies": [ | ||
55 | "vadimcn.vscode-lldb" | ||
56 | ], | ||
57 | "activationEvents": [ | 54 | "activationEvents": [ |
58 | "onLanguage:rust", | 55 | "onLanguage:rust", |
59 | "onCommand:rust-analyzer.analyzerStatus", | 56 | "onCommand:rust-analyzer.analyzerStatus", |
diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts index 6ce3b9235..99c9c5ae7 100644 --- a/editors/code/src/client.ts +++ b/editors/code/src/client.ts | |||
@@ -41,6 +41,7 @@ export async function createClient(config: Config, serverPath: string): Promise< | |||
41 | withSysroot: config.withSysroot, | 41 | withSysroot: config.withSysroot, |
42 | cargoFeatures: config.cargoFeatures, | 42 | cargoFeatures: config.cargoFeatures, |
43 | rustfmtArgs: config.rustfmtArgs, | 43 | rustfmtArgs: config.rustfmtArgs, |
44 | vscodeLldb: vscode.extensions.getExtension("vadimcn.vscode-lldb") != null, | ||
44 | }, | 45 | }, |
45 | traceOutputChannel, | 46 | traceOutputChannel, |
46 | middleware: { | 47 | middleware: { |
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index 3ade7e900..40f4c7a0d 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts | |||
@@ -156,6 +156,7 @@ export class Config { | |||
156 | get featureFlags() { return this.cfg.get("featureFlags") as Record<string, boolean>; } | 156 | get featureFlags() { return this.cfg.get("featureFlags") as Record<string, boolean>; } |
157 | get additionalOutDirs() { return this.cfg.get("additionalOutDirs") as Record<string, string>; } | 157 | get additionalOutDirs() { return this.cfg.get("additionalOutDirs") as Record<string, string>; } |
158 | get rustfmtArgs() { return this.cfg.get("rustfmtArgs") as string[]; } | 158 | get rustfmtArgs() { return this.cfg.get("rustfmtArgs") as string[]; } |
159 | get vscodeLldb() { return this.cfg.get("vscodeLldb") as boolean; } | ||
159 | 160 | ||
160 | get cargoWatchOptions(): CargoWatchOptions { | 161 | get cargoWatchOptions(): CargoWatchOptions { |
161 | return { | 162 | return { |