Skip to content

Commit 5d1707b

Browse files
committed
add type to variable
1 parent e9b4daa commit 5d1707b

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

src/context/debugger/cache.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ impl DebuggerCacheItem {
142142
dap::types::Variable {
143143
name,
144144
value,
145+
type_field: Some(value_kind_to_type_string(var.value_type)),
145146
variables_reference: ref_id,
146147
..Default::default()
147148
}
@@ -230,3 +231,18 @@ impl DebuggerCacheItem {
230231
}
231232
}
232233
}
234+
235+
fn value_kind_to_type_string(value_kind: ValueType) -> String {
236+
match value_kind {
237+
ValueType::TSTRING => "string".to_string(),
238+
ValueType::TNUMBER => "number".to_string(),
239+
ValueType::TBOOLEAN => "boolean".to_string(),
240+
ValueType::TTABLE => "table".to_string(),
241+
ValueType::TFUNCTION => "function".to_string(),
242+
ValueType::TUSERDATA => "userdata".to_string(),
243+
ValueType::TTHREAD => "thread".to_string(),
244+
ValueType::TNIL => "nil".to_string(),
245+
ValueType::GROUP => "group".to_string(),
246+
ValueType::TLIGHTUSERDATA => "userdata".to_string(),
247+
}
248+
}

src/handler/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,16 @@ pub async fn on_request_dispatch(
113113
));
114114
context.respond(response).await;
115115
}
116+
Command::ConfigurationDone => {
117+
let response = request.success(ResponseBody::ConfigurationDone);
118+
context.respond(response).await;
119+
}
120+
Command::Disconnect(_) => {
121+
let response = request.success(ResponseBody::Disconnect);
122+
context.respond(response).await;
123+
}
116124
_ => {
125+
log::warn!("Unsupported request: {:?}", request.command);
117126
let response = request.error("Unsupported request");
118127
context.respond(response).await;
119128
}

0 commit comments

Comments
 (0)