Filenames are the wrong index for Claude Code @ mentions
Blog post from Sourcegraph
A custom Claude Code fileSuggestion hook improves the @ file picker by ranking repository files using exact and fuzzy filename matches, Sourcegraph symbol-search results, and recent Git activity, addressing cases where character-based path matching returns irrelevant files or cannot find functions whose names do not appear in filenames. Exact basename matches receive the highest priority, while symbol matches enable queries such as function or type names to locate their defining files; cached symbol queries and asynchronous fetching reduce network latency. Tests on the Monty repository showed that improved filename ranking alone resolves many misleading path results, while symbol indexing is necessary for definition searches, with warm requests typically completing in about 11 milliseconds. The approach has limitations, including dependence on Sourcegraph index freshness, missing macro symbols, and ambiguity among multiple similarly named definitions. The Apache-2.0 Rust implementation is available through the Sourcegraph Community cookbook, can be configured as Claude Code’s fileSuggestion command, works anonymously for indexed public repositories, and supports private instances through endpoint and token environment variables.
No tracked trend matches for this post yet.
Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.