Conversation
- 修复问题: 消除多模式搜索导致的文件系统重复遍历与 I/O 瓶颈 * 移除 `_search_single_pattern` 和 `_search_patterns_concurrent`,引入 `_search_all_patterns` 实现单次文件遍历匹配所有正则 * 调用 `Workspace.search_content_multi_pattern` API 替代旧版 `search_content`,避免 N 次 (N=模式数量) 重复打开文件 * 优化 `_build_results_with_context` 逻辑,按需读取文件行缓存而非全量加载,解决大文件内存溢出风险 - 重构优化: 修正上下文行获取逻辑与数据格式处理 * 将匹配结果从非结构化文本字符串解析重构为原生 `list[dict]` 数据结构,消除“格式化→正则解析”的反模式 * 修复上下文行计算逻辑,支持精确获取匹配行前后指定行数 (`context_lines`) 的原始内容 * 增加正则预编译与无效模式过滤机制,提升搜索执行效率 - 破坏性变更: 底层搜索接口返回结构变更 * `symbol_ref_tool` 不再依赖 `Workspace.search_content` 的格式化字符串输出,转而使用 `search_content_multi_pattern` 的结构化字典列表 * 移除了对 `[文件] path\n----\n` 文本格式的解析代码,下游需适配新的 `file`, `line_num`, `content`, `pattern_type` 字段
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
_search_single_pattern和_search_patterns_concurrent,引入_search_all_patterns实现单次文件遍历匹配所有正则Workspace.search_content_multi_patternAPI 替代旧版search_content,避免 N 次 (N=模式数量) 重复打开文件_build_results_with_context逻辑,按需读取文件行缓存而非全量加载,解决大文件内存溢出风险list[dict]数据结构,消除“格式化→正则解析”的反模式context_lines) 的原始内容symbol_ref_tool不再依赖Workspace.search_content的格式化字符串输出,转而使用search_content_multi_pattern的结构化字典列表[文件] path\n----\n文本格式的解析代码,下游需适配新的file,line_num,content,pattern_type字段