Extract references from a source file. Automatically selects the right parser based on the file extension. Returns an empty list if the language is not supported or doesn't implement reference extraction.
(&mut self, file_path: &str, source: &str)
| 304 | /// Returns an empty list if the language is not supported or doesn't |
| 305 | /// implement reference extraction. |
| 306 | pub fn extract_references(&mut self, file_path: &str, source: &str) -> Vec<Reference> { |
| 307 | let language = match Language::detect(file_path) { |
| 308 | Some(l) => l, |
| 309 | None => return Vec::new(), |
| 310 | }; |
| 311 | |
| 312 | match self.parsers.get_mut(&language) { |
| 313 | Some(parser) => parser.extract_references(source, file_path), |
| 314 | None => Vec::new(), |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | /// Get a list of all supported languages. |
| 319 | pub fn supported_languages(&self) -> Vec<Language> { |