dap: Split out launch from init

This commit is contained in:
Blaž Hrastnik 2021-08-20 14:06:55 +09:00
parent 94a1951d40
commit a54b09e3fe
4 changed files with 43 additions and 27 deletions

View file

@ -265,7 +265,7 @@ impl Client {
pub async fn set_breakpoints(
&mut self,
file: String,
file: PathBuf,
breakpoints: Vec<SourceBreakpoint>,
) -> Result<Option<Vec<Breakpoint>>> {
let args = requests::SetBreakpointsArguments {

View file

@ -1,5 +1,6 @@
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::path::PathBuf;
pub trait Request {
type Arguments: serde::de::DeserializeOwned + serde::Serialize;
@ -91,7 +92,7 @@ pub struct Checksum {
#[serde(rename_all = "camelCase")]
pub struct Source {
pub name: Option<String>,
pub path: Option<String>,
pub path: Option<PathBuf>,
pub source_reference: Option<usize>,
pub presentation_hint: Option<String>,
pub origin: Option<String>,
@ -207,7 +208,7 @@ pub struct Variable {
pub mod requests {
use super::*;
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct InitializeArguments {
#[serde(rename = "clientID")]
@ -274,7 +275,7 @@ pub mod requests {
const COMMAND: &'static str = "configurationDone";
}
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SetBreakpointsArguments {
pub source: Source,
@ -283,7 +284,7 @@ pub mod requests {
pub source_modified: Option<bool>,
}
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SetBreakpointsResponse {
pub breakpoints: Option<Vec<Breakpoint>>,
@ -298,7 +299,7 @@ pub mod requests {
const COMMAND: &'static str = "setBreakpoints";
}
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ContinueArguments {
pub thread_id: usize,
@ -319,7 +320,7 @@ pub mod requests {
const COMMAND: &'static str = "continue";
}
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StackTraceArguments {
pub thread_id: usize,
@ -380,7 +381,7 @@ pub mod requests {
const COMMAND: &'static str = "scopes";
}
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct VariablesArguments {
pub variables_reference: usize,