Skip to content

Commit c8c04df

Browse files
committed
Add conversion types
1 parent f27e62e commit c8c04df

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

debugger/src/debugger.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use std::{
88
};
99

1010
use eyre::WrapErr;
11+
use launch_configuration::LaunchConfiguration;
1112
use retry::{delay::Exponential, retry};
1213
use server::Implementation;
1314
use transport::{
@@ -21,7 +22,7 @@ use crate::{
2122
internals::DebuggerInternals,
2223
state::{self, DebuggerState},
2324
types::{self, EvaluateResult},
24-
Event,
25+
Event, LaunchArguments,
2526
};
2627

2728
/// How to launch a debugging session
@@ -46,6 +47,21 @@ impl From<state::AttachArguments> for InitialiseArguments {
4647
}
4748
}
4849

50+
impl From<LaunchConfiguration> for InitialiseArguments {
51+
fn from(value: LaunchConfiguration) -> Self {
52+
match value {
53+
LaunchConfiguration::Debugpy(debugpy) => match debugpy.request.as_str() {
54+
"launch" => InitialiseArguments::Launch(LaunchArguments {
55+
program: debugpy.program.expect("program must be specified"),
56+
working_directory: None,
57+
language: crate::Language::DebugPy,
58+
}),
59+
other => todo!("{other}"),
60+
},
61+
}
62+
}
63+
}
64+
4965
fn retry_scale() -> impl Iterator<Item = Duration> {
5066
Exponential::from_millis(200).take(5)
5167
}
@@ -163,9 +179,7 @@ impl Debugger {
163179
let config = launch_configuration::load_from_path(Some(&name), configuration_path)
164180
.context("loading launch configuration")?;
165181
match config {
166-
ChosenLaunchConfiguration::Specific(config) => {
167-
todo!()
168-
}
182+
ChosenLaunchConfiguration::Specific(config) => Debugger::new(config),
169183
_ => Err(eyre::eyre!("specified configuration {name} not found")),
170184
}
171185
}

0 commit comments

Comments
 (0)