diff --git a/debugger/src/debugger.rs b/debugger/src/debugger.rs index 5011bb3..6942189 100644 --- a/debugger/src/debugger.rs +++ b/debugger/src/debugger.rs @@ -8,6 +8,7 @@ use std::{ }; use eyre::WrapErr; +use launch_configuration::LaunchConfiguration; use retry::{delay::Exponential, retry}; use server::Implementation; use transport::{ @@ -21,7 +22,7 @@ use crate::{ internals::DebuggerInternals, state::{self, DebuggerState}, types::{self, EvaluateResult}, - Event, + Event, LaunchArguments, }; /// How to launch a debugging session @@ -46,6 +47,21 @@ impl From for InitialiseArguments { } } +impl From 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 { Exponential::from_millis(200).take(5) } @@ -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")), } }