Search & Discovery
Comprehensive strategies for finding code, symbols, patterns, and references across your codebase
The Search Landscape
CodeMap offers six complementary search approaches:
- Text search: Find literal strings in file content
- Symbol search: Locate function/class/interface definitions
- File name search: Match files by naming patterns
- Element search: Find HTML/Vue template elements
- Relevance search: AI-powered task-to-file matching
- Project help: Discover project-specific patterns and documentation
Each serves a distinct purpose. Choosing the right tool saves time and delivers better results.
Text Search: search-in-files
Find literal text within file contents. Use for finding all usages of a specific string, locating error messages, discovering hardcoded values, tracking down code patterns.
Symbol-Scoped Search
Pass a symbol reference (relativePath$symbolName) as the scope to restrict results to within that symbol's body. This is useful for verifying an edit was applied correctly, checking what a specific function references, or confirming a pattern exists only in the expected place.
Symbol Search
Find symbol definitions (functions, classes, interfaces). Use for finding where a function/class is defined, locating interface definitions, discovering components matching a pattern.
Call Graph Queries
Once you've found a symbol, codemap_get_dependencies with a symbol reference (file.ts$symbolName) switches from file-level imports to symbol-level call tracking â returning exactly which symbols it calls and which symbols call it. This is more precise than text search for finding callers because it uses the parsed call graph rather than string matching.
File Name Search
Match files by naming patterns. Use for finding files following naming conventions, locating test files, identifying configuration files.
AI-Powered Relevance Search
Use natural language task descriptions to find files most relevant to your work. Perfect for starting work on a new feature, finding files related to a concept, or exploring unfamiliar codebases.
Project Help: Team Knowledge Base
Project Help is a searchable knowledge base for project-specific patterns, conventions, and documentation. Teams can create help topics that explain architectural decisions, coding standards, deployment procedures, and common workflows.
When to Use Project Help
- Onboarding new team members with project-specific knowledge
- Documenting recurring patterns ("How we handle authentication")
- Explaining architectural decisions and constraints
- Creating troubleshooting guides for common issues
Unlike code comments or README files, Project Help is centralized, searchable, and accessible directly through CodeMap tools without leaving your workflow.
Search Strategy Guide
| Goal | Best Tool | Example |
|---|---|---|
| Find where a function is called (text) | search-in-files | search-in-files "loginUser(" |
| Find all callers of a symbol (graph) | get-dependencies (symbol) | deps src/auth.ts$loginUser |
| Find what a symbol calls | get-dependencies (symbol) | deps src/auth.ts$loginUser |
| Find all transitive callers | impact-analysis (symbol) | impact src/auth.ts$loginUser |
| Find where a function is defined | search (symbol) | search "loginUser" --mode symbol |
| Find all controllers | find-by-name | find-by-name "*Controller.ts" |
| Find a Vue component usage | search-elements | search-elements "UserCard" |
| Search within one function only | search-in-files (symbol scope) | search-in-files "TODO" --scope src/auth.ts$loginUser |
| Start implementing a feature | find-relevant | find-relevant "user profile editing" |
| Learn project conventions | project-help | project-help "authentication" |
# Text search - find all usages
codemap search-in-files "authenticateUser"
# Symbol search - find where it's defined
codemap search "UserController" --mode symbol
# File name search - find by pattern
codemap find-by-name "*Controller.ts"# Symbol call graph: who calls deleteUser, and what does it call?
codemap deps src/services/UserService.ts$deleteUser
# Symbol-scoped text search: find TODOs inside one function only
codemap search-in-files "TODO" --scope src/services/UserService.ts$deleteUser# AI-powered relevance search
codemap find-relevant "implement user authentication"
# Element search for Vue/HTML
codemap search-elements "user-avatar"Text search finds the string loginUser( everywhere it appears â including comments and strings. codemap_get_dependencies with a symbol reference finds only real call sites parsed from the AST. Use graph-based lookup when you need precision; use text search when you need to cast a wide net.
Don't use text search when symbol search will do. Start with the most specific tool for your task, then broaden if needed. This saves time and delivers more precise results.
Search tools work best when combined with dependency analysis. After finding a file with search, use get-dependencies to see its relationships and understand the full context. Pass a symbol reference to go deeper and see call-level relationships.
The find-relevant tool uses AI to rank files by relevance to your task description. It often surfaces unexpected but valuable files that keyword search would miss.