Fix Windows path handling in diagnostic relativization

Canonicalize `current_dir()` to match canonicalized file paths (avoids
`\\?\` prefix mismatch on Windows), and normalize backslashes to
forward slashes in relative diagnostic paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Paolo Tranquilli
2026-05-13 10:31:48 +02:00
parent c3cf7c2bca
commit c2fc0cf111
3 changed files with 5 additions and 3 deletions

View File

@@ -94,7 +94,7 @@ pub fn run(options: Options) -> std::io::Result<()> {
node_types::read_node_types_str("erb", tree_sitter_embedded_template::NODE_TYPES)?;
let lines: std::io::Result<Vec<String>> = std::io::BufReader::new(file_list).lines().collect();
let lines = lines?;
let source_root = std::env::current_dir().ok();
let source_root = std::env::current_dir().ok().and_then(|d| d.canonicalize().ok());
lines
.par_iter()
.try_for_each(|line| {