mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
fixup! feat: add debug code lens
autodetect vscode-lldb
This commit is contained in:
parent
e9d025b618
commit
39c92b3872
7 changed files with 26 additions and 19 deletions
|
@ -51,6 +51,9 @@ pub struct ServerConfig {
|
|||
|
||||
/// Cargo feature configurations.
|
||||
pub cargo_features: CargoFeatures,
|
||||
|
||||
/// Enabled if the vscode_lldb extension is available.
|
||||
pub vscode_lldb: bool,
|
||||
}
|
||||
|
||||
impl Default for ServerConfig {
|
||||
|
@ -70,6 +73,7 @@ impl Default for ServerConfig {
|
|||
additional_out_dirs: FxHashMap::default(),
|
||||
cargo_features: Default::default(),
|
||||
rustfmt_args: Vec::new(),
|
||||
vscode_lldb: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -185,6 +185,7 @@ pub fn main_loop(
|
|||
all_targets: config.cargo_watch_all_targets,
|
||||
},
|
||||
rustfmt_args: config.rustfmt_args,
|
||||
vscode_lldb: config.vscode_lldb,
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -805,6 +805,9 @@ pub fn handle_code_lens(
|
|||
}),
|
||||
data: None,
|
||||
};
|
||||
lenses.push(lens);
|
||||
|
||||
if world.options.vscode_lldb {
|
||||
if r.args[0] == "run" {
|
||||
r.args[0] = "build".into();
|
||||
} else {
|
||||
|
@ -819,10 +822,9 @@ pub fn handle_code_lens(
|
|||
}),
|
||||
data: None,
|
||||
};
|
||||
|
||||
lenses.push(lens);
|
||||
lenses.push(debug_lens);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle impls
|
||||
lenses.extend(
|
||||
|
|
|
@ -37,6 +37,7 @@ pub struct Options {
|
|||
pub max_inlay_hint_length: Option<usize>,
|
||||
pub rustfmt_args: Vec<String>,
|
||||
pub cargo_watch: CheckOptions,
|
||||
pub vscode_lldb: bool,
|
||||
}
|
||||
|
||||
/// `WorldState` is the primary mutable state of the language server
|
||||
|
|
|
@ -51,9 +51,6 @@
|
|||
"typescript-formatter": "^7.2.2",
|
||||
"vsce": "^1.74.0"
|
||||
},
|
||||
"extensionDependencies": [
|
||||
"vadimcn.vscode-lldb"
|
||||
],
|
||||
"activationEvents": [
|
||||
"onLanguage:rust",
|
||||
"onCommand:rust-analyzer.analyzerStatus",
|
||||
|
|
|
@ -41,6 +41,7 @@ export async function createClient(config: Config, serverPath: string): Promise<
|
|||
withSysroot: config.withSysroot,
|
||||
cargoFeatures: config.cargoFeatures,
|
||||
rustfmtArgs: config.rustfmtArgs,
|
||||
vscodeLldb: vscode.extensions.getExtension("vadimcn.vscode-lldb") != null,
|
||||
},
|
||||
traceOutputChannel,
|
||||
middleware: {
|
||||
|
|
|
@ -156,6 +156,7 @@ export class Config {
|
|||
get featureFlags() { return this.cfg.get("featureFlags") as Record<string, boolean>; }
|
||||
get additionalOutDirs() { return this.cfg.get("additionalOutDirs") as Record<string, string>; }
|
||||
get rustfmtArgs() { return this.cfg.get("rustfmtArgs") as string[]; }
|
||||
get vscodeLldb() { return this.cfg.get("vscodeLldb") as boolean; }
|
||||
|
||||
get cargoWatchOptions(): CargoWatchOptions {
|
||||
return {
|
||||
|
|
Loading…
Reference in a new issue