Skip to content

Commit

Permalink
Sort local/static/global/sbvalue variables by name
Browse files Browse the repository at this point in the history
  • Loading branch information
nobodywasishere committed Oct 17, 2024
1 parent fe108b5 commit 8b50d97
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/build*/
/target/
*.pyc
/node_modules/
18 changes: 16 additions & 2 deletions adapter/codelldb/src/debug_session/variables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ impl super::DebugSession {
variable.name = "[return value]".to_owned();
variables.insert(0, variable);
}

variables.sort_by(|a, b| a.name.cmp(&b.name));

variables
}
Container::Statics(frame) => {
Expand All @@ -96,7 +99,11 @@ impl super::DebugSession {
in_scope_only: true,
});
let mut vars_iter = variables.iter().filter(|v| v.value_type() == ValueType::VariableStatic);
self.convert_scope_values(&mut vars_iter, "", Some(container_handle), false)?
let mut variables = self.convert_scope_values(&mut vars_iter, "", Some(container_handle), false)?;

variables.sort_by(|a, b| a.name.cmp(&b.name));

variables
}
Container::Globals(frame) => {
let variables = frame.variables(&VariableOptions {
Expand All @@ -106,7 +113,11 @@ impl super::DebugSession {
in_scope_only: true,
});
let mut vars_iter = variables.iter().filter(|v| v.value_type() == ValueType::VariableGlobal);
self.convert_scope_values(&mut vars_iter, "", Some(container_handle), false)?
let mut variables = self.convert_scope_values(&mut vars_iter, "", Some(container_handle), false)?;

variables.sort_by(|a, b| a.name.cmp(&b.name));

variables
}
Container::Registers(frame) => {
let list = frame.registers();
Expand All @@ -132,6 +143,9 @@ impl super::DebugSession {
};
variables.push(raw);
}

variables.sort_by(|a, b| a.name.cmp(&b.name));

variables
}
Container::StackFrame(_) => vec![],
Expand Down

0 comments on commit 8b50d97

Please sign in to comment.