From 8d5c1c1457e8a8a8802125e93a772865971a3673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Eriksson?= Date: Sun, 22 Dec 2024 16:11:45 +0100 Subject: [PATCH] tsparser: handle files in app root --- tsparser/src/legacymeta/schema.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tsparser/src/legacymeta/schema.rs b/tsparser/src/legacymeta/schema.rs index fcee134e37..dd523e3a01 100644 --- a/tsparser/src/legacymeta/schema.rs +++ b/tsparser/src/legacymeta/schema.rs @@ -576,12 +576,12 @@ pub(super) fn loc_from_range( let pkg_name = rel_path .parent() .and_then(|p| p.file_name()) + .or_else(|| app_root.file_name()) .map(|s| s.to_string_lossy().to_string()) .ok_or(range.parse_err("missing package name"))?; let pkg_path = rel_path .parent() - .map(|s| s.to_string_lossy().to_string()) - .ok_or(range.parse_err("missing package path"))?; + .map_or(".".to_string(), |s| s.to_string_lossy().to_string()); (pkg_path, pkg_name, file_name) } Err(_) => {