Skip to content

Commit

Permalink
error: align error text
Browse files Browse the repository at this point in the history
  • Loading branch information
imkiva committed Dec 11, 2022
1 parent a2ef13f commit be5b7a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions base/src/test/resources/failure/syntax/issue164.aya.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ In file $FILE:3:26 ->
^^

Error: Parser error: Cannot parse

In file $FILE:8:29 ->

6 | def uncurry3 (A : Type) (B : Type) (C : Type) (D : Type)
Expand All @@ -15,7 +15,7 @@ In file $FILE:8:29 ->
^^

Error: Parser error: Cannot parse

In file $FILE:1:0 ->

1 | def uncurry (A : Type) (B : Type) (C : Type)
Expand All @@ -27,19 +27,19 @@ In file $FILE:1:0 ->
5 |

Error: Unsolved meta _

In file $FILE:6:0 ->

4 | => f (p.1) (p.2)
5 |
6 | def uncurry3 (A : Type) (B : Type) (C : Type) (D : Type)
^-------------------------------------------------------^ Begin of the
error
error
7 | (f : Pi A B C -> D)
8 | (p : Sig A B C) : D
^---------------------------------^ End of the error

Error: Unsolved meta _

4 error(s), 0 warning(s).
What are you doing?
4 error(s), 0 warning(s).
What are you doing?
4 changes: 2 additions & 2 deletions pretty/src/main/java/org/aya/pretty/error/PrettyError.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ public record PrettyError(
} else {
if (lineNo == primaryRange.startLine()) {
var hintUnderline = renderHint(primaryRange.startCol(), line.length(), linenoWidth);
docs.append(Doc.cat(hintUnderline, Doc.ONE_WS, Doc.english("Begin of the error")));
docs.append(Doc.stickySep(hintUnderline, Doc.align(Doc.english("Begin of the error"))));
} else if (lineNo == primaryRange.endLine()) {
var hintUnderline = renderHint(primaryRange.startCol(), line.length(), linenoWidth);
docs.append(Doc.cat(hintUnderline, Doc.ONE_WS, Doc.english("End of the error")));
docs.append(Doc.stickySep(hintUnderline, Doc.align(Doc.english("End of the error"))));
}
}
}
Expand Down

0 comments on commit be5b7a9

Please sign in to comment.