diff options
author | Jonas Schievink <[email protected]> | 2021-03-10 19:30:20 +0000 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-03-10 19:30:20 +0000 |
commit | 7b1a0d5fb724d3f802fe23f9b4455ffd6d7e114f (patch) | |
tree | eea0095d9f73595b93058160082b28524142ecc7 /crates/ide/src | |
parent | 6c32e2d8a045e4ba7d45ac9651572a226324cefa (diff) |
Diagnose files that aren't in the module tree
Diffstat (limited to 'crates/ide/src')
-rw-r--r-- | crates/ide/src/diagnostics.rs | 16 |
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 | } |