aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2021-03-10 19:30:20 +0000
committerJonas Schievink <[email protected]>2021-03-10 19:30:20 +0000
commit7b1a0d5fb724d3f802fe23f9b4455ffd6d7e114f (patch)
treeeea0095d9f73595b93058160082b28524142ecc7
parent6c32e2d8a045e4ba7d45ac9651572a226324cefa (diff)
Diagnose files that aren't in the module tree
-rw-r--r--crates/ide/src/diagnostics.rs16
1 files changed, 13 insertions, 3 deletions
diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs
index fe32f39b6..760c84780 100644
--- a/crates/ide/src/diagnostics.rs
+++ b/crates/ide/src/diagnostics.rs
@@ -197,9 +197,19 @@ pub(crate) fn diagnostics(
197 ); 197 );
198 }); 198 });
199 199
200 if let Some(m) = sema.to_module_def(file_id) { 200 match sema.to_module_def(file_id) {
201 m.diagnostics(db, &mut sink); 201 Some(m) => m.diagnostics(db, &mut sink),
202 }; 202 None => {
203 res.borrow_mut().push(
204 Diagnostic::hint(
205 parse.tree().syntax().text_range(),
206 "file not included in module tree".to_string(),
207 )
208 .with_unused(true),
209 );
210 }
211 }
212
203 drop(sink); 213 drop(sink);
204 res.into_inner() 214 res.into_inner()
205} 215}