@@ -14,6 +14,7 @@ public class LJDiagnostic extends RuntimeException {
1414 private final String customMessage ;
1515 private String file ;
1616 private ErrorPosition position ;
17+ private static final String PIPE = " | " ;
1718
1819 public LJDiagnostic (String title , String message , SourcePosition pos , String accentColor , String customMessage ) {
1920 this .title = title ;
@@ -104,14 +105,13 @@ public String getSnippet() {
104105
105106 // calculate padding for line numbers
106107 int padding = String .valueOf (endLine ).length ();
107- String pipe = " | " ;
108108
109109 for (int i = startLine ; i <= endLine ; i ++) {
110110 String lineNumStr = String .format ("%" + padding + "d" , i );
111111 String line = lines .get (i - 1 );
112112
113113 // add line
114- sb .append (Colors .GREY ).append (lineNumStr ).append (pipe ).append (line ).append (Colors .RESET ).append ("\n " );
114+ sb .append (Colors .GREY ).append (lineNumStr ).append (PIPE ).append (line ).append (Colors .RESET ).append ("\n " );
115115
116116 // add error markers on the line(s) with the error
117117 if (i >= position .lineStart () && i <= position .lineEnd ()) {
@@ -120,14 +120,14 @@ public String getSnippet() {
120120
121121 if (colStart > 0 && colEnd > 0 ) {
122122 // line number padding + pipe + column offset
123- String indent = " " .repeat (padding ) + Colors .GREY + pipe + Colors .RESET
123+ String indent = " " .repeat (padding ) + Colors .GREY + PIPE + Colors .RESET
124124 + " " .repeat (colStart - 1 );
125125 String markers = accentColor + "^" .repeat (Math .max (1 , colEnd - colStart + 1 ));
126126 sb .append (indent ).append (markers );
127127
128128 // custom message
129129 if (customMessage != null && !customMessage .isBlank ()) {
130- String offset = " " .repeat (padding + colEnd + pipe .length () + 1 );
130+ String offset = " " .repeat (padding + colEnd + PIPE .length () + 1 );
131131 sb .append (" " + customMessage .replace ("\n " , "\n " + offset ));
132132 }
133133 sb .append (Colors .RESET ).append ("\n " );
0 commit comments