Stop manually importing Angular components, directives, and pipes. Let Angular Auto-Import handle it for you with intelligent Quick Fixes and bulk import capabilities.
Angular Auto-Import transforms how you work with Angular templates by eliminating the tedious task of manually importing components, directives, and pipes. Just use the element in your template, and let the extension handle the rest.
- Fix All Missing Imports - Import all missing Angular elements in your file with one command
- Go to Definition - Navigate to any unimported element's source with a single click (Material Design, Angular CDK, any npm package)
- Intelligent Quick Fixes - Get instant import suggestions with enhanced accuracy and performance
- Works with External Libraries - Auto-import from any Angular library in your node_modules
- Monorepo Ready - Seamless support for Nx and multi-project workspaces
The most powerful feature - fix all missing imports in your file with a single command. No more going through each element one by one.
How to use:
- Open the Command Palette (
Ctrl+Shift+P/Cmd+Shift+P) - Run
Angular Auto Import: Fix all missing imports in current file - All missing components, directives, and pipes are automatically imported
Perfect for:
- Cleaning up newly created templates
- Fixing imports after moving components between files
- Bulk importing elements from external libraries
Get intelligent, context-aware import suggestions with improved accuracy and performance.
Key improvements:
- Faster detection - Instant diagnostics for missing imports
- Smarter suggestions - Prioritizes local components over library imports
- Better accuracy - Correctly resolves standalone vs module-based components
- Path alias support - Uses your
tsconfig.jsonpath mappings (@app/*,@shared/*)
How to use:
- Hover over any underlined Angular element
- Click the lightbulb or press
Ctrl+./Cmd+. - Select the appropriate import from the suggestions
Navigate directly to the source of any unimported Angular component, directive, or pipe with a single click. This is especially powerful for external libraries like Angular Material.
Key features:
- Works for external libraries - Click on Material Design components, Angular CDK, and any other npm package to jump to their source
- Accurate navigation - Navigates to the actual component declaration, not just the entry point (e.g.,
button.component.tsinstead ofpublic-api.ts) - Multi-project support - Works seamlessly across monorepos and projects with re-exported components
- No import required - Explore library source without importing first
How to use:
- Hover over any unimported Angular element in your template
Ctrl+Click(orCmd+Clickon Mac) or pressF12- Jump directly to the component's source file
Example:
<!-- No import needed - just Ctrl+Click to see the source -->
<button mat-raised-button>Click Me</button>- π‘ Smart Completions - IntelliSense for Angular elements as you type in templates
- π¦ External Library Support - Auto-import from any Angular package in node_modules
- π’ Monorepo Support - Works seamlessly with Nx and multi-project workspaces
- π― Standalone Component Support - Full support for both standalone and NgModule-based architecture
- π§ Configurable Diagnostics - Control severity levels and diagnostic modes
- Install the extension from the VS Code Marketplace
- Open any Angular project (standalone components required)
- Use any component, directive, or pipe in your template
- Let the extension handle the imports automatically
That's it! The extension activates automatically when you open an Angular project.
- Open VS Code
- Press
Ctrl+Shift+X/Cmd+Shift+Xto open Extensions view - Search for
Angular Auto Import - Click Install
Visit the VS Code Marketplace and click Install.
The extension highlights any unimported Angular elements in your templates with a diagnostic indicator (configurable severity - error, warning, or info):
<!-- Diagnostic shown here -->
<button mat-raised-button>Click Me</button>This diagnostic tells you:
- What's missing - The exact component, directive, or pipe name
- Where it comes from - The module or library providing it
- How to fix it - Quick Fix suggestions or direct navigation
Diagnostic modes:
full(default) - Shows visible diagnostics with quick fix optionsquickfix-only- Shows quick fixes without visible squiggly linesdisabled- Turn off all diagnostics
When you see a diagnostic for an unimported element:
- Hover over the element or place your cursor on it
- Press
Ctrl+./Cmd+.or click the lightbulb icon - Select the import suggestion (e.g.,
Import ButtonComponent from '@angular/material/button')
The extension automatically:
- Adds the import statement to your TypeScript file
- Updates the component's
importsarray (for standalone components)
Explore source code without importing:
- Hover over any unimported Angular element (you'll see the diagnostic)
- Press
F12orCtrl+Click/Cmd+Click - Jump directly to the component's source file
Works perfectly for:
- Material Design components
- Angular CDK utilities
- Third-party Angular libraries
- Your own local components
For files with multiple missing imports:
- Open the Command Palette (
Ctrl+Shift+P/Cmd+Shift+P) - Run
Angular Auto Import: Fix all missing imports in current file - Done - All missing imports are added automatically
Start typing an Angular element in your template:
- Type
<my-compβ Get component suggestions - Type
[my-dirβ Get directive suggestions - Type
| myPipeβ Get pipe suggestions
Press Enter to insert the element. The extension will automatically add the import if needed.
Customize the extension's behavior in your VS Code settings (File > Preferences > Settings or settings.json):
| Setting | Description | Default |
|---|---|---|
angular-auto-import.projectPath |
Absolute path to Angular project root. Overrides workspace folder detection. Useful for monorepos. | null |
angular-auto-import.index.refreshInterval |
Auto-reindex interval in minutes. Set to 0 to disable periodic reindexing. |
60 |
| Setting | Description | Default |
|---|---|---|
angular-auto-import.completion.components.enabled |
Enable component auto-completion in templates | true |
angular-auto-import.completion.directives.enabled |
Enable directive auto-completion in templates | true |
angular-auto-import.completion.pipes.enabled |
Enable pipe auto-completion in templates | true |
| Setting | Description | Default |
|---|---|---|
angular-auto-import.diagnostics.mode |
Diagnostic mode: - full: Show diagnostics + quick fixes- quickfix-only: Quick fixes without visible diagnostics- disabled: Turn off all diagnostics |
full |
angular-auto-import.diagnostics.severity |
Severity level for missing imports: error, warning, or info |
warning |
Access these commands from the Command Palette (Ctrl+Shift+P / Cmd+Shift+P):
| Command | Description | When to Use |
|---|---|---|
| Fix all missing imports in current file | Automatically imports all missing Angular elements in the active file | After creating new templates or moving code between files |
| Reindex Project(s) | Manually triggers a full project reindex | When new components aren't being detected |
| Clear Cache | Clears all cached indexing data | When experiencing persistent issues or after major project changes |
| Show Logs | Opens the extension's output channel | For debugging or reporting issues |
Problem: Components, directives, or pipes aren't showing in suggestions or quick fixes.
Solutions:
- Run
Angular Auto Import: Reindex Project(s)from the Command Palette - Verify your
tsconfig.jsonincludes all source files - Run
Angular Auto Import: Show Logsto check for parsing errors
- Angular: 14.2+ (standalone component support required)
- TypeScript: 4.8+
- VS Code: 1.80+
- Node.js: 16+ (for project indexing)
- Standalone Components Only: This extension works exclusively with Angular standalone components. Traditional NgModule-based projects are not supported. Report issues on GitHub Issues.
Does this work with NgModule-based projects?
No, Angular Auto-Import requires Angular standalone components (Angular 14+). NgModule-based projects are not supported.
Can I use this with external libraries?
Yes! The extension automatically indexes components, directives, and pipes from any Angular library in your node_modules.
Does it work with Nx monorepos?
Yes, Angular Auto-Import has full support for Nx and other monorepo setups. Each project is indexed separately.
How do I disable diagnostics but keep quick fixes?
Set "angular-auto-import.diagnostics.mode": "quickfix-only" in your settings.
Why are some components not being detected?
Ensure:
- Files are included in your
tsconfig.json - Run
Angular Auto Import: Reindex Project(s)command
Can I navigate to external library source code?
Yes! The "Go to Definition" feature lets you explore any unimported component, directive, or pipe from external libraries (Material Design, Angular CDK, etc.) without importing it first. Just Ctrl+Click on the element in your template to jump to its source file.
- Report Bugs: GitHub Issues
Enjoying Angular Auto-Import? Leave a β review on the VS Code Marketplace!
