diff --git a/sixtyfps_compiler/typeloader.rs b/sixtyfps_compiler/typeloader.rs index 1af3c0082..3c01516d9 100644 --- a/sixtyfps_compiler/typeloader.rs +++ b/sixtyfps_compiler/typeloader.rs @@ -234,7 +234,13 @@ impl<'a> TypeLoader<'a> { } }; - self.load_file(&path_canon, source_code, build_diagnostics).await; + self.load_file( + &path_canon, + SourceFile::new(path.to_owned()), + source_code, + build_diagnostics, + ) + .await; let _ok = self.all_documents.currently_loading.remove(path_canon.as_path()); assert!(_ok); Some(path_canon) @@ -246,13 +252,14 @@ impl<'a> TypeLoader<'a> { pub async fn load_file( &mut self, path: &Path, + source_path: SourceFile, source_code: String, build_diagnostics: &mut BuildDiagnostics, ) { let (dependency_doc, mut dependency_diagnostics) = - crate::parser::parse(source_code, Some(&path)); + crate::parser::parse(source_code, Some(&source_path)); - dependency_diagnostics.current_path = SourceFile::new(path.to_owned()); + dependency_diagnostics.current_path = source_path; if dependency_diagnostics.has_error() { build_diagnostics.add(dependency_diagnostics); diff --git a/tools/lsp/main.rs b/tools/lsp/main.rs index 7ef12d44e..fbefb7189 100644 --- a/tools/lsp/main.rs +++ b/tools/lsp/main.rs @@ -192,9 +192,14 @@ fn reload_document( document_cache.newline_offsets.insert(uri.clone(), newline_offsets); let path = Path::new(uri.path()); - let path = path.canonicalize().unwrap_or_else(|_| path.to_owned()); + let path_canon = path.canonicalize().unwrap_or_else(|_| path.to_owned()); let mut diag = BuildDiagnostics::default(); - spin_on::spin_on(document_cache.documents.load_file(&path, content, &mut diag)); + spin_on::spin_on(document_cache.documents.load_file( + &path_canon, + sixtyfps_compilerlib::diagnostics::SourceFile::new(path.to_owned()), + content, + &mut diag, + )); for file_diag in diag.into_iter() { if file_diag.current_path.is_relative() {