@@ -311,7 +311,7 @@ impl Command {
311 dap_in, "Step in",
311 dap_in, "Step in",
312 dap_out, "Step out",
312 dap_out, "Step out",
313 dap_next, "Step to next",
313 dap_next, "Step to next",
314− dap_variable_scopes, "List variable scopes",
314+ dap_variables, "List variables",
315 dap_terminate, "End debug session",
315 dap_terminate, "End debug session",
316 suspend, "Suspend"
316 suspend, "Suspend"
@@ -1910,53 +1910,6 @@ mod cmd {
1914− cx: &mut compositor::Context,
1916− _event: PromptEvent,
1917− ) -> anyhow::Result<()> {
1918− use helix_lsp::block_on;
1920− let scope = args.get(0).and_then(|arg| arg.parse::<usize>().ok());
1921− if scope.is_none() {
1922− cx.editor.set_status("Please provide scope ID".to_owned());
1926− if let Some(debugger) = &mut cx.editor.debugger {
1927− if debugger.is_running {
1929− .set_status("Cannot access variables while target is running".to_owned());
1932− if debugger.stack_pointer.is_none() {
1934− .set_status("Cannot find current stack pointer to access variables".to_owned());
1938− let response = block_on(debugger.variables(scope.unwrap()));
1940− let status = match response {
1942− let mut s = String::new();
1944− let prefix = match var.data_type {
1945− Some(data_type) => format!("{} ", data_type),
1946− None => "".to_owned(),
1948− s.push_str(&format!("{}{} = {}; ", prefix, var.name, var.value));
1952− Err(_) => "Failed to get variables".to_owned(),
1955− cx.editor.set_status(status);
1960 pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
1913 pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
1961 TypableCommand {
1914 TypableCommand {
1962 name: "quit",
1915 name: "quit",
@@ -2195,13 +2148,6 @@ mod cmd {
2195 doc: "Display tree sitter scopes, primarily for theming and development.",
2148 doc: "Display tree sitter scopes, primarily for theming and development.",
2196 fun: tree_sitter_scopes,
2149 fun: tree_sitter_scopes,
2197 completer: None,
2150 completer: None,
2202− doc: "Display variables of scope. Get scope names using a command in debug menu",
@@ -4466,7 +4412,7 @@ fn dap_next(cx: &mut Context) {
4469−fn dap_variable_scopes(cx: &mut Context) {
4415+fn dap_variables(cx: &mut Context) {
4470 use helix_lsp::block_on;
4416 use helix_lsp::block_on;
4472 if let Some(debugger) = &mut cx.editor.debugger {
4418 if let Some(debugger) = &mut cx.editor.debugger {
@@ -4483,12 +4429,22 @@ fn dap_variable_scopes(cx: &mut Context) {
4484 let frame_id = debugger.stack_pointer.clone().unwrap().id;
4430 let frame_id = debugger.stack_pointer.clone().unwrap().id;
4485 let scopes = block_on(debugger.scopes(frame_id)).unwrap();
4431 let scopes = block_on(debugger.scopes(frame_id)).unwrap();
4432+ let mut s = String::new();
4487− let mut status = String::new();
4488 for scope in scopes.iter() {
4434 for scope in scopes.iter() {
4435+ let response = block_on(debugger.variables(scope.variables_reference));
4437+ if let Ok(vars) = response {
4439+ let prefix = match var.data_type {
4440+ Some(data_type) => format!("{} ", data_type),
4441+ None => "".to_owned(),
4489− status.push_str(&format!("{}: {}; ", scope.variables_reference, scope.name))
4443+ s.push_str(&format!("{}{} = {}; ", prefix, var.name, var.value));
4491− cx.editor.set_status(status);
4447+ cx.editor.set_status(s);