Error Lens: Inline Error & Warning Highlighting
Complete guide to the Error Lens VS Code extension, inline diagnostic messages, font customization, filtering noise, and boosting debugging speed.
What It Does
Error Lens (usernamehw.errorlens) enhances VS Code's language diagnostics by printing compiler errors, linter warnings, and hints directly inline at the end of the line, complete with highlighted background tints.
Why Use It
- Eliminates Hovering: Read the full error description instantly without pausing to hover your mouse over squiggly lines.
- Instant Feedback: See syntax errors and type mismatches immediately as you write code.
- Color-Coded Severity: Errors (red), warnings (yellow), and info/hints (blue) stand out clearly.
Installation
- VS Code Marketplace: Search for
usernamehw.errorlensand click Install. - CLI:
code --install-extension usernamehw.errorlens
Configuration
In .vscode/settings.json:
{
// Show error only after typing stops (debounce delay in ms)
"errorLens.delay": 300,
// Render icons in the gutter
"errorLens.gutterIconsEnabled": true,
// Customize message template
"errorLens.messageTemplate": "[$source] $message",
// Suppress subtle warnings if preferred
"errorLens.enabledDiagnosticLevels": [
"error",
"warning"
],
// Exclude noisy linters or specific error codes
"errorLens.exclude": [
"eslint(prettier/prettier)"
]
}Use Cases & Examples
When a TypeScript type error occurs:
const count: number = "hello";
// Inline renders: [ts] Type 'string' is not assignable to type 'number'. (2322)You see the error message immediately in bright red at the end of line, allowing you to correct it without lifting your hands from the keyboard.
Alternatives
- Built-in VS Code Squiggles: Native subtle underlines; requires mouse hover or opening the Problems panel (Cmd/Ctrl + Shift + M).
- Inline Diagnostics: Built-in experimental VS Code feature (
editor.inlineSuggest.enabled).
Performance & Security Considerations
- Visual Clutter: In projects with hundreds of pre-existing warnings, Error Lens can feel visually overwhelming. Use
"errorLens.enabledDiagnosticLevels": ["error"]to restrict display to blocking errors only. - Resource Usage: Lightweight extension that reads standard VS Code language diagnostic events without spawning external processes.
Related Guides
GitLens: Git Supercharged
Complete guide to the GitLens VS Code extension, inline blame annotations, visual commit graph, file history revisions, and branch comparisons.
Tailwind CSS IntelliSense
Complete guide to the Tailwind CSS IntelliSense VS Code extension, autocomplete, hover preview of generated CSS, color decorators, and class validation.