增量更新单个文件
(&mut self, file_path: &PathBuf)
| 69 | |
| 70 | /// 增量更新单个文件 |
| 71 | pub fn refresh_file(&mut self, file_path: &PathBuf) -> Result<(), String> { |
| 72 | info!("Refreshing file: {}", file_path.display()); |
| 73 | |
| 74 | // 检查文件是否需要更新 |
| 75 | if let Ok(needs_update) = self.incremental_manager.needs_update(file_path) { |
| 76 | if !needs_update { |
| 77 | debug!("File {} unchanged, skipping", file_path.display()); |
| 78 | return Ok(()); |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | // 使用解析器刷新文件 |
| 83 | let mut entity_graph = self.entity_graph.write(); |
| 84 | let mut call_graph = self.call_graph.write(); |
| 85 | |
| 86 | self.parser.refresh_file(file_path, &mut entity_graph, &mut call_graph)?; |
| 87 | |
| 88 | // 更新统计信息 |
| 89 | entity_graph.update_stats(); |
| 90 | call_graph.update_stats(); |
| 91 | |
| 92 | info!("Successfully refreshed file: {}", file_path.display()); |
| 93 | Ok(()) |
| 94 | } |
| 95 | |
| 96 | /// 批量更新多个文件 |
| 97 | pub fn refresh_files(&mut self, file_paths: &[PathBuf]) -> Result<(), String> { |
no test coverage detected