Skip to content

Commit de7d084

Browse files
committed
refactor: Clean up GolangFinder code by removing unnecessary optional keyword checks
- Removed redundant checks for optional keywords in the matchesSearchPattern function. - Streamlined the code for better readability and maintainability.
1 parent f6e6d9c commit de7d084

1 file changed

Lines changed: 0 additions & 13 deletions

File tree

src/finder/golang-finder.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ export class GolangFinder implements LanguageFinder {
117117
try {
118118
// 快速检查文件内容(使用缓存)
119119
const content = await this.getFileContent(file)
120-
121120
// 检查是否包含搜索模式中的所有关键词
122121
if (this.matchesSearchPattern(content, searchPattern)) {
123122
return file
@@ -129,14 +128,12 @@ export class GolangFinder implements LanguageFinder {
129128
}
130129
}),
131130
)
132-
133131
for (const result of results) {
134132
if (result) {
135133
candidateFiles.push(result)
136134
}
137135
}
138136
}
139-
140137
return candidateFiles
141138
}
142139
catch (error) {
@@ -181,16 +178,6 @@ export class GolangFinder implements LanguageFinder {
181178
return false
182179
}
183180
}
184-
185-
// 如果有可选关键词,至少匹配一个
186-
if (pattern.optional.length > 0) {
187-
const hasOptional = pattern.optional.some(keyword => content.includes(keyword))
188-
if (!hasOptional) {
189-
// 如果没有可选关键词,仍然返回 true(因为必需关键词已匹配)
190-
// 这样可以确保即使没有类型信息也能找到匹配
191-
}
192-
}
193-
194181
return true
195182
}
196183

0 commit comments

Comments
 (0)