mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
Fix reporting tests
This commit is contained in:
parent
d2900630f2
commit
ed0c64ca7c
3 changed files with 65 additions and 41 deletions
|
@ -1238,9 +1238,8 @@ fn to_bad_ident_expr_report<'b>(
|
|||
lines.convert_region(surroundings),
|
||||
lines.convert_region(region),
|
||||
),
|
||||
alloc.concat([alloc.reflow(
|
||||
r"I recommend using camelCase, it is the standard in the Roc ecosystem.",
|
||||
)]),
|
||||
alloc.concat([alloc
|
||||
.reflow(r"I recommend using camelCase. It's the standard style in Roc code!")]),
|
||||
])
|
||||
}
|
||||
|
||||
|
|
|
@ -549,8 +549,8 @@ impl<'a> RocDocAllocator<'a> {
|
|||
let this_line_number_length = line_number.len();
|
||||
|
||||
let line = self.src_lines[i as usize];
|
||||
|
||||
let rest_of_line = if !line.trim().is_empty() {
|
||||
let is_line_empty = line.trim().is_empty();
|
||||
let rest_of_line = if !is_line_empty {
|
||||
self.text(line).indent(indent)
|
||||
} else {
|
||||
self.nil()
|
||||
|
@ -572,11 +572,17 @@ impl<'a> RocDocAllocator<'a> {
|
|||
.append(self.text(GUTTER_BAR).annotate(Annotation::GutterBar))
|
||||
.append(rest_of_line)
|
||||
} else {
|
||||
self.text(" ".repeat(max_line_number_length - this_line_number_length))
|
||||
let up_to_gutter = self
|
||||
.text(" ".repeat(max_line_number_length - this_line_number_length))
|
||||
.append(self.text(line_number).annotate(Annotation::LineNumber))
|
||||
.append(self.text(GUTTER_BAR).annotate(Annotation::GutterBar))
|
||||
.append(self.text(" "))
|
||||
.append(rest_of_line)
|
||||
.append(self.text(GUTTER_BAR).annotate(Annotation::GutterBar));
|
||||
|
||||
if is_line_empty {
|
||||
// Don't put an trailing space after the gutter
|
||||
up_to_gutter
|
||||
} else {
|
||||
up_to_gutter.append(self.text(" ")).append(rest_of_line)
|
||||
}
|
||||
};
|
||||
|
||||
result = result.append(source_line);
|
||||
|
@ -667,8 +673,8 @@ impl<'a> RocDocAllocator<'a> {
|
|||
let this_line_number_length = line_number.len();
|
||||
|
||||
let line: &str = self.src_lines.get(i as usize).unwrap_or(&"");
|
||||
|
||||
let rest_of_line = if !line.trim().is_empty() {
|
||||
let is_line_empty = line.trim().is_empty();
|
||||
let rest_of_line = if !is_line_empty {
|
||||
self.text(line)
|
||||
.annotate(Annotation::CodeBlock)
|
||||
.indent(indent)
|
||||
|
@ -691,11 +697,17 @@ impl<'a> RocDocAllocator<'a> {
|
|||
.append(self.text(GUTTER_BAR).annotate(Annotation::GutterBar))
|
||||
.append(rest_of_line)
|
||||
} else {
|
||||
self.text(" ".repeat(max_line_number_length - this_line_number_length))
|
||||
let up_to_gutter = self
|
||||
.text(" ".repeat(max_line_number_length - this_line_number_length))
|
||||
.append(self.text(line_number).annotate(Annotation::LineNumber))
|
||||
.append(self.text(GUTTER_BAR).annotate(Annotation::GutterBar))
|
||||
.append(self.text(" "))
|
||||
.append(rest_of_line)
|
||||
.append(self.text(GUTTER_BAR).annotate(Annotation::GutterBar));
|
||||
|
||||
if is_line_empty {
|
||||
// Don't put an trailing space after the gutter
|
||||
up_to_gutter
|
||||
} else {
|
||||
up_to_gutter.append(self.text(" ")).append(rest_of_line)
|
||||
}
|
||||
};
|
||||
|
||||
result = result.append(source_line);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue