MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / getParserCandidates

Method getParserCandidates

packages/parser/src/sniffer.ts:145–157  ·  view source on GitHub ↗

* 获取所有匹配的解析器(按优先级排序) * 用于 fallback 机制 * @param filePath 文件路径 * @returns 所有匹配的解析器列表

(filePath: string)

Source from the content-addressed store, hash-verified

143 * @returns 所有匹配的解析器列表
144 */
145 getParserCandidates(filePath: string): Parser[] {
146 const ext = getExtension(filePath)
147 const headContent = readFileHead(filePath)
148 const results: Parser[] = []
149
150 for (const { feature, parser } of this.formats) {
151 if (this.matchFeature(feature, ext, headContent, filePath)) {
152 results.push(parser)
153 }
154 }
155
156 return results
157 }
158
159 /**
160 * 根据格式 ID 获取解析器

Callers

nothing calls this directly

Calls 3

matchFeatureMethod · 0.95
getExtensionFunction · 0.85
readFileHeadFunction · 0.85

Tested by

no test coverage detected