diff options
Diffstat (limited to 'crates/ra_analysis/src/imp.rs')
-rw-r--r-- | crates/ra_analysis/src/imp.rs | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index c1269025c..060e2b606 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs | |||
@@ -222,9 +222,15 @@ impl AnalysisImpl { | |||
222 | .into_iter() | 222 | .into_iter() |
223 | .filter_map(|module_id| { | 223 | .filter_map(|module_id| { |
224 | let link = module_id.parent_link(&module_tree)?; | 224 | let link = module_id.parent_link(&module_tree)?; |
225 | let ModuleSource::File(file_id) = link.owner(&module_tree).source(&module_tree); | 225 | let file_id = match link.owner(&module_tree).source(&module_tree) { |
226 | let syntax = self.db.file_syntax(file_id); | 226 | ModuleSource::File(file_id) => file_id, |
227 | let decl = link.bind_source(&module_tree, syntax.ast()); | 227 | ModuleSource::Inline(..) => { |
228 | //TODO: https://github.com/rust-analyzer/rust-analyzer/issues/181 | ||
229 | return None; | ||
230 | } | ||
231 | }; | ||
232 | let decl = link.bind_source(&module_tree, &self.db); | ||
233 | let decl = decl.ast(); | ||
228 | 234 | ||
229 | let sym = FileSymbol { | 235 | let sym = FileSymbol { |
230 | name: decl.name().unwrap().text(), | 236 | name: decl.name().unwrap().text(), |
@@ -243,9 +249,7 @@ impl AnalysisImpl { | |||
243 | .modules_for_file(file_id) | 249 | .modules_for_file(file_id) |
244 | .into_iter() | 250 | .into_iter() |
245 | .map(|it| it.root(&module_tree)) | 251 | .map(|it| it.root(&module_tree)) |
246 | .map(|it| match it.source(&module_tree) { | 252 | .filter_map(|it| it.source(&module_tree).as_file()) |
247 | ModuleSource::File(file_id) => file_id, | ||
248 | }) | ||
249 | .filter_map(|it| crate_graph.crate_id_for_crate_root(it)) | 253 | .filter_map(|it| crate_graph.crate_id_for_crate_root(it)) |
250 | .collect(); | 254 | .collect(); |
251 | 255 | ||
@@ -367,7 +371,7 @@ impl AnalysisImpl { | |||
367 | }) | 371 | }) |
368 | .collect::<Vec<_>>(); | 372 | .collect::<Vec<_>>(); |
369 | if let Some(m) = module_tree.any_module_for_file(file_id) { | 373 | if let Some(m) = module_tree.any_module_for_file(file_id) { |
370 | for (name_node, problem) in m.problems(&module_tree, syntax.ast()) { | 374 | for (name_node, problem) in m.problems(&module_tree, &self.db) { |
371 | let diag = match problem { | 375 | let diag = match problem { |
372 | Problem::UnresolvedModule { candidate } => { | 376 | Problem::UnresolvedModule { candidate } => { |
373 | let create_file = FileSystemEdit::CreateFile { | 377 | let create_file = FileSystemEdit::CreateFile { |
@@ -535,9 +539,7 @@ impl AnalysisImpl { | |||
535 | }; | 539 | }; |
536 | module_id | 540 | module_id |
537 | .child(module_tree, name.as_str()) | 541 | .child(module_tree, name.as_str()) |
538 | .map(|it| match it.source(&module_tree) { | 542 | .and_then(|it| it.source(&module_tree).as_file()) |
539 | ModuleSource::File(file_id) => file_id, | ||
540 | }) | ||
541 | .into_iter() | 543 | .into_iter() |
542 | .collect() | 544 | .collect() |
543 | } | 545 | } |