MCPcopy Create free account
hub / github.com/CodeBendKit/codeseek / _remove_file_entities

Method _remove_file_entities

rust-core/src/codegraph/parser.rs:302–329  ·  view source on GitHub ↗

移除文件相关的所有实体

(
        &mut self,
        file_path: &PathBuf,
        entity_graph: &mut EntityGraph,
        call_graph: &mut PetCodeGraph,
    )

Source from the content-addressed store, hash-verified

300
301 /// 移除文件相关的所有实体
302 fn _remove_file_entities(
303 &mut self,
304 file_path: &PathBuf,
305 entity_graph: &mut EntityGraph,
306 call_graph: &mut PetCodeGraph,
307 ) {
308 // 获取文件的所有实体ID
309 let entity_ids = self.file_index.get_all_entity_ids(file_path);
310 let function_ids = self.file_index.get_all_function_ids(file_path);
311 let _class_ids = self.file_index.get_all_class_ids(file_path);
312
313 // 从图中移除
314 for entity_id in entity_ids {
315 entity_graph.remove_entity(&entity_id);
316 }
317
318 for function_id in function_ids {
319 if let Some(node_index) = call_graph.get_node_index(&function_id) {
320 call_graph.graph.remove_node(node_index);
321 call_graph.function_to_node.remove(&function_id);
322 call_graph.node_to_function.remove(&node_index);
323 }
324 }
325
326 // 清理索引
327 self.file_index.remove_file(file_path);
328 self.snippet_index.clear_file_cache(file_path);
329 }
330
331 /// 更新代码片段索引
332 fn _update_snippet_index(

Callers 1

refresh_fileMethod · 0.45

Calls 7

get_all_entity_idsMethod · 0.80
get_all_function_idsMethod · 0.80
get_all_class_idsMethod · 0.80
remove_entityMethod · 0.80
get_node_indexMethod · 0.80
remove_fileMethod · 0.80
clear_file_cacheMethod · 0.80

Tested by

no test coverage detected