MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / extract

Method extract

atomic-semantic/src/parsers/mod.rs:289–299  ·  view source on GitHub ↗

Extract entities from a source file. Automatically selects the right parser based on the file extension. Returns an empty list if the language is not supported.

(&mut self, file_path: &str, source: &str)

Source from the content-addressed store, hash-verified

287 /// Automatically selects the right parser based on the file extension.
288 /// Returns an empty list if the language is not supported.
289 pub fn extract(&mut self, file_path: &str, source: &str) -> Vec<Entity> {
290 let language = match Language::detect(file_path) {
291 Some(l) => l,
292 None => return Vec::new(),
293 };
294
295 match self.parsers.get_mut(&language) {
296 Some(parser) => parser.extract(source, file_path),
297 None => Vec::new(),
298 }
299 }
300
301 /// Extract references from a source file.
302 ///

Callers 7

test_extract_typescriptFunction · 0.45
test_extract_pythonFunction · 0.45
test_extract_rustFunction · 0.45
test_extract_goFunction · 0.45
test_extract_javaFunction · 0.45

Calls 1

get_mutMethod · 0.80

Tested by 7

test_extract_typescriptFunction · 0.36
test_extract_pythonFunction · 0.36
test_extract_rustFunction · 0.36
test_extract_goFunction · 0.36
test_extract_javaFunction · 0.36