From da035fd6c9daee7e49e3e548b0d9f5d9a60106b9 Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Fri, 8 Mar 2024 15:23:20 +0200 Subject: [PATCH] fix: Include messageDetails in VS Code links --- src/formatter/text.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/formatter/text.ts b/src/formatter/text.ts index 419182757..c6b9c5549 100644 --- a/src/formatter/text.ts +++ b/src/formatter/text.ts @@ -43,7 +43,6 @@ export class Text { totalWarningCount += warningCount; totalFatalErrorCount += fatalErrorCount; - // this.#writeln(chalk.inverse(filePath)); this.#writeln(chalk.inverse(path.resolve(process.cwd(), filePath))); // Group messages by rule @@ -77,13 +76,16 @@ export class Text { if (messages) { this.#writeln(chalk.bold(` ${chalk.dim("0:0")} ${ruleId} (${messages.length})`)); messages.forEach((msg) => { + const formattedLocation = + formatLocation(msg.line, msg.column, lineInfoLength, columnInfoLength); + const messageDetails = (showDetails && msg.messageDetails) ? - (`\n ${chalk.white.bold("Details:")}\n ` + - `${chalk.italic(msg.messageDetails.replaceAll("\n", "\n "))}`) : + (`\n ${formattedLocation} ${chalk.white.bold("Details:")} ` + + `${chalk.italic(msg.messageDetails.replaceAll("\n", `\n ${formattedLocation} `))}`) : ""; this.#writeln( - ` ${formatLocation(msg.line, msg.column, lineInfoLength, columnInfoLength)} ` + + ` ${formattedLocation} ` + `${formatSeverity(msg.severity)} ` + `${msg.message}` + `${messageDetails}`);