Cross-language code intelligence powered by graph analysis.
CodeGraph analyzes your codebase to understand relationships between files, functions, and modules. It provides dependency graphs, call graphs, impact analysis, and AI-optimized context β all accessible through VS Code commands, chat participants, and Language Model Tools.
Traditional code exploration requires multiple grep searches, file reads, and manual analysis. CodeGraph provides semantic understanding of your code:
| Task | Traditional Approach | With CodeGraph |
|---|---|---|
| "What does this function call?" | 5-7 grep/read operations | 1 call graph query |
| "What breaks if I change this?" | Manual tracing across files | 1 impact analysis |
| "Show me dependencies" | Parse imports manually | 1 dependency graph |
| "Get context for AI" | Read multiple related files | 1 context request |
Benchmarks show 75-80% reduction in tool calls and tokens when AI agents use CodeGraph tools vs. traditional file operations.
See what files and modules your code depends on β and what depends on it.
Understand function call relationships: who calls what, and how deep the call chain goes.
Before you refactor, know exactly what will break. See direct impacts, indirect impacts, and affected tests.
CodeGraph provides tools for AI assistants (GitHub Copilot, Claude, etc.) to understand your code more efficiently:
- @codegraph chat participant β Ask questions in any AI chat
- Language Model Tools β AI agents can autonomously query code structure
- Intent-aware context β Get relevant code based on what you're trying to do (explain, modify, debug, test)
Works with TypeScript, JavaScript, Python, Rust, and Go in the same project.
- Install CodeGraph from the VS Code Marketplace
- Open a project with supported languages
- Wait for initial indexing (status bar shows progress)
- Use commands from the Command Palette (
Ctrl+Shift+P/Cmd+Shift+P)
| Command | Description |
|---|---|
CodeGraph: Show Dependency Graph |
Visualize module dependencies |
CodeGraph: Show Call Graph |
Show function call relationships |
CodeGraph: Analyze Impact |
Analyze impact of modifying current symbol |
CodeGraph: Show Parser Metrics |
View parsing statistics |
CodeGraph: Reindex Workspace |
Force re-indexing of all files |
In any VS Code AI chat, mention @codegraph to get code intelligence:
@codegraph what are the dependencies of this file?
@codegraph show me the call graph for this function
@codegraph what would break if I change this?
@codegraph find tests related to this code
CodeGraph registers 6 tools that AI agents can use autonomously:
| Tool | Purpose |
|---|---|
codegraph_get_dependency_graph |
Analyze file/module dependencies |
codegraph_get_call_graph |
Map function call relationships |
codegraph_analyze_impact |
Assess change impact before refactoring |
codegraph_get_ai_context |
Get intent-aware code context |
codegraph_find_related_tests |
Discover tests for a code location |
codegraph_get_symbol_info |
Get symbol metadata and usage |
See AI_TOOL_EXAMPLES.md for detailed usage examples and best practices.
| Setting | Description | Default |
|---|---|---|
codegraph.enabled |
Enable/disable the extension | true |
codegraph.languages |
Languages to index | ["python", "rust", "typescript", "javascript", "go"] |
codegraph.indexOnStartup |
Index workspace on startup | true |
codegraph.maxFileSizeKB |
Maximum file size to index (KB) | 1024 |
codegraph.excludePatterns |
Glob patterns to exclude | ["**/node_modules/**", "**/target/**", ...] |
codegraph.ai.maxContextTokens |
Max tokens for AI context | 4000 |
codegraph.ai.contextStrategy |
Context selection strategy | "smart" |
codegraph.visualization.defaultDepth |
Default graph depth | 3 |
codegraph.cache.enabled |
Enable query caching | true |
codegraph.parallelParsing |
Enable parallel file parsing | true |
- VS Code 1.90+ (required for Language Model Tools API)
- Rust toolchain (for building the LSP server from source)
CodeGraph consists of two main components:
The extension provides the user interface: commands, visualizations, chat participant, and Language Model Tools registration. It communicates with the LSP server over the standard Language Server Protocol.
A high-performance LSP server built with tower-lsp that handles all code analysis. It uses the codegraph Rust ecosystem for parsing and graph construction:
| Crate | Purpose |
|---|---|
codegraph |
Core graph data structures and query engine |
codegraph-parser-api |
Unified parser trait for all languages |
codegraph-typescript |
TypeScript/JavaScript parser (tree-sitter) |
codegraph-python |
Python parser (rustpython-parser) |
codegraph-rust |
Rust parser (syn + tree-sitter) |
codegraph-go |
Go parser (tree-sitter) |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β VS Code Extension (TS) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Commands β Chat Participant β Language Model Tools β
β & Views β (@codegraph) β (AI Agent Access) β
ββββββββββββββββ΄ββββββββββββββββββββ΄ββββββββββββββββββββββββββ
β
LSP Protocol
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Rust LSP Server (tower-lsp) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Parser Registry β
β ββββββββββββββ ββββββββββ ββββββββ ββββββ β
β β TypeScript β β Python β β Rust β β Go β β
β ββββββββββββββ ββββββββββ ββββββββ ββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β CodeGraph Core: Semantic Graph β Query Engine β Caching β
βββββββββββββββββββββββββββββββββββ΄ββββββββββββββ΄ββββββββββββββ
The Rust server provides sub-100ms response times for navigation queries and can index a 100k LOC codebase in under 10 seconds.
# Clone the repository
git clone https://github.com/anvanster/codegraph-vscode
cd codegraph-vscode
# Install dependencies
npm install
# Build the Rust LSP server
cd server && cargo build --release && cd ..
# Build the extension
npm run compile
# Package the extension
npm run package# Watch mode for TypeScript
npm run watch
# Run tests
npm test
# Launch Extension Development Host
# Press F5 in VS CodeApache-2.0
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Found a bug or have a feature request? Open an issue.