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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 558 additions and 234 deletions

View file

@ -193,10 +193,10 @@ impl MessageEditor {
let highlights = editor.text_highlights::<Self>(cx);
let text = editor.text(cx);
let snapshot = editor.buffer().read(cx).snapshot(cx);
let mentions = if let Some((_, ranges)) = highlights {
let mentions = if let Some(ranges) = highlights {
ranges
.iter()
.map(|range| range.to_offset(&snapshot))
.map(|(range, _)| range.to_offset(&snapshot))
.zip(self.mentions.iter().copied())
.collect()
} else {
@ -483,20 +483,19 @@ impl MessageEditor {
let end = multi_buffer.anchor_after(range.end);
mentioned_user_ids.push(user.id);
anchor_ranges.push(start..end);
anchor_ranges.push((
start..end,
HighlightStyle {
font_weight: Some(FontWeight::BOLD),
..Default::default()
},
));
}
}
}
editor.clear_highlights::<Self>(cx);
editor.highlight_text::<Self>(
anchor_ranges,
HighlightStyle {
font_weight: Some(FontWeight::BOLD),
..Default::default()
},
cx,
)
editor.highlight_text::<Self>(anchor_ranges, cx)
});
this.mentions = mentioned_user_ids;