MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / extract_file

Function extract_file

codegraph-kernel/src/lib.rs:233–263  ·  view source on GitHub ↗
(file_path: String, content: String, language: String)

Source from the content-addressed store, hash-verified

231
232#[napi]
233pub fn extract_file(file_path: String, content: String, language: String) -> Result<ExtractBuffers> {
234 // The whole walk runs under the stack guard (stack.rs, #1581): a file
235 // nested deeply enough to overflow this thread's stack comes back as a
236 // `defer:` error — the TS side's routine "take the wasm path" signal —
237 // instead of a SIGSEGV that kills the entire indexer process.
238 let out = stack::run_guarded(|| match language.as_str() {
239 "java" => java::extract(&file_path, &content),
240 "python" => python::extract(&file_path, &content),
241 "go" => go::extract(&file_path, &content),
242 "c" | "cpp" => ccpp::extract(&file_path, &content, &language),
243 "rust" => rustlang::extract(&file_path, &content),
244 "csharp" => csharp::extract(&file_path, &content),
245 "ruby" => ruby::extract(&file_path, &content),
246 "php" => php::extract(&file_path, &content),
247 "swift" => swift::extract(&file_path, &content),
248 "kotlin" => kotlin::extract(&file_path, &content),
249 "r" => rlang::extract(&file_path, &content),
250 "lua" | "luau" => lua::extract(&file_path, &content, &language),
251 "scala" => scala::extract(&file_path, &content),
252 "dart" => dart::extract(&file_path, &content),
253 _ => tsjs::extract(&file_path, &content, &language),
254 })
255 .map_err(Error::from_reason)?;
256 Ok(ExtractBuffers {
257 meta: out.meta.into(),
258 nodes: out.nodes.into(),
259 edges: out.edges.into(),
260 refs: out.refs.into(),
261 arena: out.arena.into(),
262 })
263}

Callers

nothing calls this directly

Calls 2

run_guardedFunction · 0.85
extractFunction · 0.70

Tested by

no test coverage detected