Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-diagnostics/src/handlers/unlinked_file.rs')
-rw-r--r--crates/ide-diagnostics/src/handlers/unlinked_file.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/crates/ide-diagnostics/src/handlers/unlinked_file.rs b/crates/ide-diagnostics/src/handlers/unlinked_file.rs
index 1b71a3a3e6..a1573bab8a 100644
--- a/crates/ide-diagnostics/src/handlers/unlinked_file.rs
+++ b/crates/ide-diagnostics/src/handlers/unlinked_file.rs
@@ -4,7 +4,7 @@ use std::iter;
use hir::{db::DefDatabase, DefMap, InFile, ModuleSource};
use ide_db::{
- base_db::{FileLoader, SourceDatabaseExt},
+ base_db::{FileLoader, SourceDatabase, SourceRootDatabase},
source_change::SourceChange,
FileId, FileRange, LineIndexDatabase,
};
@@ -47,7 +47,7 @@ pub(crate) fn unlinked_file(
//
// Only show this diagnostic on the first three characters of
// the file, to avoid overwhelming the user during startup.
- range = FileLoader::file_text(ctx.sema.db, file_id)
+ range = SourceDatabase::file_text(ctx.sema.db, file_id)
.char_indices()
.take(3)
.last()
@@ -502,4 +502,16 @@ mod bar {
"#,
);
}
+
+ #[test]
+ fn include_macro_works() {
+ check_diagnostics(
+ r#"
+//- minicore: include
+//- /main.rs
+include!("bar/foo/mod.rs");
+//- /bar/foo/mod.rs
+"#,
+ );
+ }
}