For issue 6771, the function region_with_subregion
in crates/reporting/src/report.rs
seems to be responsible for determining the color of the text. I was thinking about adding theSeverity
enum in crates/compiler/problem/src/lib.rs
, but since so many functions have both direct and indirect dependencies on region_with_subregion
it is turning into a massive change. Is there a better way to do this or is there only pain when it comes to making this change? :laughing:
pub fn region_with_subregion(
&'a self,
region: LineColumnRegion,
sub_region: LineColumnRegion,
) -> DocBuilder<'a, Self, Annotation> {
...
if error_highlight_line {
let highlight_text = ERROR_UNDERLINE
.repeat((sub_region.end().column - sub_region.start().column) as usize);
let highlight_line = self
.line()
// Omit the gutter bar when we know there are no further
// line numbers to be printed after this!
.append(self.text(" ".repeat(max_line_number_length + GUTTER_BAR_WIDTH)))
.append(if highlight_text.is_empty() {
self.nil()
} else {
self.text(" ".repeat(sub_region.start().column as usize))
.indent(indent)
.append(self.text(highlight_text).annotate(Annotation::Error))
});
result = result.append(highlight_line);
}
...
}
Thanks for looking into this @John Konecny, I do indeed believe a large amount of changes is necessary.
Thanks for the clarification! By the way it’s all good if someone beats me to this fix.
@Anton
https://github.com/roc-lang/roc/pull/6794
I kicked off CI for this
Last updated: Jul 06 2025 at 12:14 UTC