diff --git a/.changeset/breezy-llamas-behave.md b/.changeset/breezy-llamas-behave.md new file mode 100644 index 000000000..ca0cc3e54 --- /dev/null +++ b/.changeset/breezy-llamas-behave.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix certain characters showing incorrectly in `astro check` diff --git a/packages/astro/src/cli/check/print.ts b/packages/astro/src/cli/check/print.ts index 26866c051..5c40f785e 100644 --- a/packages/astro/src/cli/check/print.ts +++ b/packages/astro/src/cli/check/print.ts @@ -11,6 +11,7 @@ import { white, yellow, } from 'kleur/colors'; +import { fileURLToPath } from 'url'; import stringWidth from 'string-width'; export function printDiagnostic(filePath: string, text: string, diag: Diagnostic): string { @@ -19,9 +20,10 @@ export function printDiagnostic(filePath: string, text: string, diag: Diagnostic // Lines and characters are 0-indexed, so we need to add 1 to the offset to get the actual line and character const realStartLine = diag.range.start.line + 1; const realStartCharacter = diag.range.start.character + 1; + const normalizedFilePath = fileURLToPath(new URL(filePath, 'file://')); // IDE friendly path that user can CTRL+Click to open the file at a specific line / character - const IDEFilePath = `${bold(cyan(filePath))}:${bold(yellow(realStartLine))}:${bold( + const IDEFilePath = `${bold(cyan(normalizedFilePath))}:${bold(yellow(realStartLine))}:${bold( yellow(realStartCharacter) )}`; result.push(