提取代码片段内容
(&self, lines: &[&str], start_line: usize, end_line: usize)
| 658 | |
| 659 | /// 提取代码片段内容 |
| 660 | fn _extract_code_snippet(&self, lines: &[&str], start_line: usize, end_line: usize) -> String { |
| 661 | let start_idx = (start_line - 1).min(lines.len()); |
| 662 | let end_idx = end_line.min(lines.len()); |
| 663 | |
| 664 | if start_idx >= end_idx { |
| 665 | return String::new(); |
| 666 | } |
| 667 | |
| 668 | lines[start_idx..end_idx].join("\n") |
| 669 | } |
| 670 | |
| 671 | /// 解析目录下的所有文件 |
| 672 | pub fn parse_directory(&mut self, dir: &Path) -> Result<(), String> { |
no outgoing calls
no test coverage detected