Skip to content

Commit

Permalink
Add conversion types
Browse files Browse the repository at this point in the history
  • Loading branch information
simonrw committed Jan 16, 2025
1 parent f27e62e commit c8c04df
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions debugger/src/debugger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::{
};

use eyre::WrapErr;
use launch_configuration::LaunchConfiguration;
use retry::{delay::Exponential, retry};
use server::Implementation;
use transport::{
Expand All @@ -21,7 +22,7 @@ use crate::{
internals::DebuggerInternals,
state::{self, DebuggerState},
types::{self, EvaluateResult},
Event,
Event, LaunchArguments,
};

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

impl From<LaunchConfiguration> for InitialiseArguments {
fn from(value: LaunchConfiguration) -> Self {
match value {
LaunchConfiguration::Debugpy(debugpy) => match debugpy.request.as_str() {
"launch" => InitialiseArguments::Launch(LaunchArguments {
program: debugpy.program.expect("program must be specified"),
working_directory: None,
language: crate::Language::DebugPy,
}),
other => todo!("{other}"),
},
}
}
}

fn retry_scale() -> impl Iterator<Item = Duration> {
Exponential::from_millis(200).take(5)
}
Expand Down Expand Up @@ -163,9 +179,7 @@ impl Debugger {
let config = launch_configuration::load_from_path(Some(&name), configuration_path)
.context("loading launch configuration")?;
match config {
ChosenLaunchConfiguration::Specific(config) => {
todo!()
}
ChosenLaunchConfiguration::Specific(config) => Debugger::new(config),
_ => Err(eyre::eyre!("specified configuration {name} not found")),
}
}
Expand Down

0 comments on commit c8c04df

Please sign in to comment.