fix: preserve diagnostics after extensionless Windows paths

(cherry picked from commit 2a2e6e3848)
This commit is contained in:
Eneko Ruiz authored and haelyra committed 2026-10-20 17:38:38 -04:00
1 parent 58b191c25d
commit 9388e06ec7
2 files changed
+18 -2

No files matched your search

+2 -2
View File
@@ -24,8 +24,8 @@ function normalizeFailureReason(reason) {
// Quoted Windows paths preserve spaces in the final path component.
.replace(/(["'])(?:[a-z]:[\\/]|\\\\)[^\r\n]*?\1/gu, '$1<path>$1')
// Directories may contain spaces, but trailing whitespace separates diagnostic prose.
// A colon delimits spaced leaves; trailing separators belong to the path.
.replace(/(?:\b[a-z]:|\\)[\\/](?:[^\\/:*?"<>|\r\n]*[^\s\\/:*?"<>|][\\/])*[^\s\\/:*?"<>|(),;]+(?: [^\\/:*?"<>|\r\n]+(?=:))?[\\/]*/gu, '<path>')
// Spaced leaves need an extension before a colon, or quotes; preserve extensionless diagnostics.
.replace(/(?:\b[a-z]:|\\)[\\/](?:[^\\/:*?"<>|\r\n]*[^\s\\/:*?"<>|][\\/])*[^\s\\/:*?"<>|(),;]+(?: [^\\/:*?"<>|\r\n]*\.[\p{L}\p{N}_-]+(?=:))?[\\/]*/gu, '<path>')
// Strip remaining file paths
.replace(/(?:\b[a-z]:)?[\\/][\w./\\-]+/g, '<path>')
// Collapse whitespace