![]()
Inverigator is a powerful VS Code extension that helps developers navigate InversifyJS dependency injection containers. Jump instantly from injected dependencies to their concrete implementations, making it easier to understand and work with complex IoC container setups. Table of Contents
Features🚀 Smart Navigation
🔍 Comprehensive Scanning
⚡ Developer Experience
🎯 Flexible Configuration
InstallationFrom VS Code Marketplace
From VSIX Package
UsageNavigation CommandsInverigator provides several commands for navigating your InversifyJS containers: Go to Implementation (
|
Command | Windows/Linux | macOS |
---|---|---|
Go to Implementation | Ctrl+Alt+F12 or Alt+F12 or Ctrl+Alt+I |
Cmd+Alt+F12 or Alt+F12 or Cmd+Alt+I |
Context Menus
Inverigator integrates seamlessly with VS Code's context menus:
- Editor Context Menu: Right-click in any TypeScript file to access "Go to Inversify Implementation"
- Editor Title Bar: Quick access buttons for "Show All Bindings" and "Rescan Container Files"
- Explorer Context Menu: Right-click TypeScript files in the explorer to trigger rescanning
- Command Palette: All commands available via
Ctrl+Shift+P
/Cmd+Shift+P
Configuration
Extension Settings
Configure Inverigator through VS Code settings (File > Preferences > Settings
or settings.json
):
inverigator.containerPaths
Array of glob patterns to identify InversifyJS container files.
Default:
[
"**/container.ts",
"**/inversify.config.ts",
"**/ioc.ts"
]
Example:
{
"inverigator.containerPaths": [
"**/container.ts",
"**/di-container.ts",
"**/src/config/ioc.ts"
]
}
inverigator.autoScanOnSave
Automatically rescan container files when they are saved.
Default: true
inverigator.maxScanDepth
Maximum depth to follow imports when scanning modular containers.
Default: 5
(Range: 1-10)
inverigator.enableCodeLens
Show clickable "Go to Implementation" links above InversifyJS injections and bindings.
Default: true
inverigator.maxFilesToScan
Maximum number of files to scan to prevent memory issues in large workspaces. Use -1
for unlimited.
Default: 1000
(Range: -1 to 10000)
inverigator.scanTimeout
Timeout in milliseconds for scanning operations. Use -1
for unlimited.
Default: 30000
(Range: -1 to 600000)
inverigator.useCache
Use cached bindings from .inverigator
folder for faster startup.
Default: true
inverigator.cacheMaxAge
Maximum age of cache in milliseconds before it's considered stale.
Default: 3600000
(1 hour)
inverigator.showWelcomeMessage
Show welcome message with binding count on first installation.
Default: true
Caching System
Inverigator uses an intelligent caching system to provide instant startup after the initial scan:
- Cache Location:
.inverigator
folder in your project root - Cache Contents:
bindings.json
- All discovered InversifyJS bindingsinjections.json
- Interface-to-token mappingsmetadata.json
- Cache version and configuration hash
- Cache Invalidation: Automatic when:
- Configuration settings change
- Container files are modified (with auto-scan enabled)
- Cache age exceeds configured maximum
- Manual Cache Management:
Inverigator: Show Cache Statistics
- View cache age and sizeInverigator: Clear Cache
- Force cache rebuild on next scan
Note: Add .inverigator/
to your .gitignore
file to exclude cache from version control.
Ignore Patterns
Create a .inverigatorignore
file in your project root to exclude specific files or directories from scanning. The file uses gitignore-style syntax.
Default exclusions:
- Test files (
*.test.ts
,*.spec.ts
,__tests__/
,__mocks__/
) - Build outputs (
dist/
,build/
,out/
) - Dependencies (
node_modules/
,vendor/
) - Type definitions (
*.d.ts
) - Temporary files (
tmp/
,temp/
)
Example .inverigatorignore
:
# Custom exclusions
examples/
archived/
legacy/
# Exclude specific patterns
**/*.backup.ts
**/*.old.ts
# Exclude generated files
src/generated/
To generate a sample ignore file, use the command: Inverigator: Generate .inverigatorignore File
How It Works
Inverigator uses advanced TypeScript AST parsing to understand your InversifyJS container configuration:
Discovery Phase
- Scans workspace for container files matching configured patterns
- Uses content-based scanning to find all
.bind(
patterns - Recursively follows imports to discover modular registries
Analysis Phase
- Parses TypeScript AST to extract binding information
- Maps injection tokens (strings, Symbols, identifiers) to implementations
- Resolves TypeScript path aliases using
tsconfig.json
- Follows export declarations to find actual implementations
Indexing Phase
- Builds comprehensive maps of:
- Token → Implementation class
- Interface → Token (from
@inject
decorators) - Service classes and their locations
- Builds comprehensive maps of:
Navigation Phase
- Determines context at cursor position (token, interface, or property)
- Resolves through injection mappings if needed
- Opens implementation file at the correct location
Requirements
- VS Code version 1.103.0 or higher
- TypeScript project using InversifyJS for dependency injection
- TypeScript installed in your project (used for AST parsing)
Known Issues
- Complex dynamic bindings may not be detected
- Conditional bindings based on runtime values are not fully supported
- Very large workspaces may experience initial scanning delays
Please report issues on our GitHub repository.
Release Notes
0.0.1 - Initial Release
Features
- ✨ Basic navigation from injection tokens to implementations
- ✨ Support for Symbol and string-based tokens
- ✨ Content-based scanning strategy
- ✨ TypeScript config path alias resolution
- ✨ Interface and property navigation
- ✨ CodeLens integration
- ✨ Context menu integration
- ✨ Multiple keyboard shortcuts
- ✨ Configurable container paths
- ✨
.inverigatorignore
file support - ✨ Real-time file watching
- ✨ Output channel for diagnostics
Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
- Clone the repository
- Run
npm install
to install dependencies - Open the project in VS Code
- Press
F5
to launch a new VS Code window with the extension loaded - Make changes and test them in the Extension Development Host
Running Tests
npm run test # Run all tests
npm run lint # Run linting
npm run check-types # Type checking
License
This extension is licensed under the MIT License.
Enjoy navigating your InversifyJS containers with ease! 🚀
If you find this extension helpful, please consider:
- ⭐ Starring the repository on GitHub
- 📝 Leaving a review on the VS Code Marketplace
- 🐛 Reporting issues or suggesting features