debugger: Process ANSI color escape codes in console (#32817)

- [x] foreground highlights
- [x] background highlights
- [x] advertise support in DAP capabilities

Closes #31372

Release Notes:

- Debugger Beta: added basic support for highlighting in the console
based on ANSI escape codes.
This commit is contained in:
Cole Miller
2025-06-16 17:39:53 -04:00
committed by GitHub
parent 1f457169ba
commit ffc6218349
23 changed files with 558 additions and 234 deletions
@@ -510,10 +510,9 @@ impl EditorTestContext {
editor
.background_highlights
.get(&TypeId::of::<Tag>())
.map(|h| h.1.clone())
.unwrap_or_default()
.iter()
.map(|range| range.to_offset(&snapshot.buffer_snapshot))
.into_iter()
.flat_map(|highlights| highlights.as_slice())
.map(|highlight| highlight.range.to_offset(&snapshot.buffer_snapshot))
.collect()
});
assert_set_eq!(actual_ranges, expected_ranges);
@@ -525,7 +524,12 @@ impl EditorTestContext {
let snapshot = self.update_editor(|editor, window, cx| editor.snapshot(window, cx));
let actual_ranges: Vec<Range<usize>> = snapshot
.text_highlight_ranges::<Tag>()
.map(|ranges| ranges.as_ref().clone().1)
.map(|ranges| {
ranges
.iter()
.map(|(range, _)| range.clone())
.collect::<Vec<_>>()
})
.unwrap_or_default()
.into_iter()
.map(|range| range.to_offset(&snapshot.buffer_snapshot))