aboutsummaryrefslogtreecommitdiff
path: root/helix-dap
diff options
context:
space:
mode:
Diffstat (limited to 'helix-dap')
-rw-r--r--helix-dap/src/client.rs15
-rw-r--r--helix-dap/src/types.rs31
2 files changed, 46 insertions, 0 deletions
diff --git a/helix-dap/src/client.rs b/helix-dap/src/client.rs
index ebaae83c..98b88e23 100644
--- a/helix-dap/src/client.rs
+++ b/helix-dap/src/client.rs
@@ -352,4 +352,19 @@ impl Client {
self.request::<requests::Pause>(args).await
}
+
+ pub async fn eval(
+ &mut self,
+ expression: String,
+ frame_id: Option<usize>,
+ ) -> Result<requests::EvaluateResponse> {
+ let args = requests::EvaluateArguments {
+ expression,
+ frame_id,
+ context: None,
+ format: None,
+ };
+
+ self.request::<requests::Evaluate>(args).await
+ }
}
diff --git a/helix-dap/src/types.rs b/helix-dap/src/types.rs
index 4ee796b3..bb73e5e9 100644
--- a/helix-dap/src/types.rs
+++ b/helix-dap/src/types.rs
@@ -484,6 +484,37 @@ pub mod requests {
type Result = ();
const COMMAND: &'static str = "pause";
}
+
+ #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[serde(rename_all = "camelCase")]
+ pub struct EvaluateArguments {
+ pub expression: String,
+ pub frame_id: Option<usize>,
+ pub context: Option<String>,
+ pub format: Option<ValueFormat>,
+ }
+
+ #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
+ #[serde(rename_all = "camelCase")]
+ pub struct EvaluateResponse {
+ pub result: String,
+ #[serde(rename = "type")]
+ pub data_type: Option<String>,
+ pub presentation_hint: Option<VariablePresentationHint>,
+ pub variables_reference: usize,
+ pub named_variables: Option<usize>,
+ pub indexed_variables: Option<usize>,
+ pub memory_reference: Option<String>,
+ }
+
+ #[derive(Debug)]
+ pub enum Evaluate {}
+
+ impl Request for Evaluate {
+ type Arguments = EvaluateArguments;
+ type Result = EvaluateResponse;
+ const COMMAND: &'static str = "evaluate";
+ }
}
// Events