MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / querySymbolTokens

Function querySymbolTokens

src/search/query-paths.ts:138–150  ·  view source on GitHub ↗

* The precise symbol tokens a query names, excluding the files it names * (`editorOptions.ts` is identifier-shaped too). Split on the same brackets * the seeder splits on, so `clampedInt()` still counts.

(tokens: readonly string[], indexedBasenames: ReadonlySet<string>)

Source from the content-addressed store, hash-verified

136 * the seeder splits on, so `clampedInt()` still counts.
137 */
138function querySymbolTokens(tokens: readonly string[], indexedBasenames: ReadonlySet<string>): string[] {
139 const out = new Set<string>();
140 for (const raw of tokens) {
141 for (const part of raw.split(/[,()[\]{}]+/)) {
142 const t = part.replace(/^['"`<]+/, '').replace(/['"`>.,;:!?]+$/, '');
143 if (t.length < 3 || !SYMBOL_TOKEN.test(t) || !isPreciseSymbolToken(t)) continue;
144 if (indexedBasenames.has(t.toLowerCase())) continue;
145 out.add(t);
146 if (out.size >= MAX_SYMBOL_TOKENS) return [...out];
147 }
148 }
149 return [...out];
150}
151
152/**
153 * Lowercased basename stems of the hyphen-named indexed files, stem → paths.

Callers 1

narrowBySymbolsFunction · 0.85

Calls 3

isPreciseSymbolTokenFunction · 0.85
hasMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected