[K1, K2, CLI] Mark whole position range of compiler diagnostics in CLI

#KT-64989
This commit is contained in:
Evgeniy.Zhelenskiy
2024-01-15 21:36:56 +01:00
committed by Space Team
parent 5b11308d1b
commit 7eab4b672d
278 changed files with 929 additions and 907 deletions
@@ -74,6 +74,8 @@ public abstract class PlainTextMessageRenderer implements MessageRenderer {
int line = location != null ? location.getLine() : -1;
int column = location != null ? location.getColumn() : -1;
int lineEnd = location != null ? location.getLineEnd() : -1;
int columnEnd = location != null ? location.getColumnEnd() : -1;
String lineContent = location != null ? location.getLineContent() : null;
String path = location != null ? getPath(location) : null;
@@ -122,7 +124,13 @@ public abstract class PlainTextMessageRenderer implements MessageRenderer {
result.append(lineContent);
result.append(LINE_SEPARATOR);
result.append(StringsKt.repeat(" ", column - 1));
result.append("^");
if (lineEnd > line) {
result.append(StringsKt.repeat("^", lineContent.length() - column + 1));
} else if (lineEnd == line && columnEnd > column) {
result.append(StringsKt.repeat("^", columnEnd - column));
} else {
result.append("^");
}
}
return result.toString();