IgnoreLens
A VS Code extension that shows how many files each ignore line matches and highlights redundant lines.
It tracks a running count of ignored files (the number in brackets). Normal lines add to this count, while negation lines (!) remove from it.

Usage
IgnoreLens activates automatically for its 47 supported file types. The majority of these follow the .gitignore syntax.
To use with any file, change its language mode to ignore via the status bar or command palette (Ctrl+Shift+P → "Change Language Mode").
Match Counts
IgnoreLens decorates each line depending upon how it affects the running count of workspace files.
| Symbol |
Meaning |
+N |
Files added to running count |
−N |
Files removed from running count |
(N) |
Running count total |
≡N |
Already counted (shadowed by earlier line) |
∅N |
Not in count (no matches) |
✗N |
Blocked by parent directory |
Counts are colour-coded:
- Green: Line is adding files
- Yellow: Negation line, or shadowed line (files already ignored by earlier line)
- Red: Redundant line (matches nothing)
Real-time Updates
Decorations update automatically when you edit the file or when workspace files change.
Supported Files
IgnoreLens supports 47 ignore file formats with accurate semantics:
Standard gitignore rules apply:
* matches anything except /, ** matches any path including /, ? matches single character
*.ext matches at any depth (basename matching)
dir/ directory pattern, blocks negations for files inside
!pattern negation (un-ignore), # comment
- Trims trailing spaces only (tabs preserved)
Configuration
Access settings via File → Preferences → Settings (or Ctrl+,) and search for "ignorelens".
| Setting |
Description |
Default |
ignorelens.enabled |
Enable or disable decorations |
true |
ignorelens.decorationStyle |
How to highlight redundant lines: none, background, text, or both |
text |
ignorelens.showMatchCount |
Show match counts after each line |
true |
ignorelens.scanDebounceMs |
Delay before rescanning after changes (ms) |
500 |
ignorelens.debug |
Enable debug logging to Output panel |
false |
Customising Colours
Add to your settings.json:
{
"workbench.colorCustomizations": {
"ignorelens.noMatchForeground": "#f14c4c", // Red text for redundant lines
"ignorelens.noMatchBackground": "#4a1a1a40", // Red background for redundant lines
"ignorelens.matchCountForeground": "#6A9955", // Green text for matching lines
"ignorelens.negationForeground": "#CCAA00", // Yellow text for negation lines
"ignorelens.staleMatchCountForeground": "#3d5c30", // Stale: darker green
"ignorelens.staleNoMatchForeground": "#8b2020", // Stale: darker red
"ignorelens.staleNoMatchBackground": "#2a0a0a40", // Stale: darker red background
"ignorelens.staleNegationForeground": "#7a6600" // Stale: darker yellow
}
}
The stale colours are shown briefly when switching tabs while cached data refreshes.
Limitations / Notes
Each file is analysed independently. IgnoreLens doesn't consider how multiple ignore files interact. For example, ripgrep allows .rgignore to override .gitignore rules, but IgnoreLens shows each file's matches in isolation.
Empty directories are not detected. Directories are discovered by scanning files, so lines targeting empty directories will show zero matches even if the directory exists.
Hidden files are included in counts. Files with the hidden attribute (Windows), hidden flag (macOS), or starting with . (Linux/Unix) are counted like regular files.
Technology Stack
- Language: TypeScript 5.3.0+
- Framework: VS Code Extension API (1.85.0+)
- Key Libraries:
ignore (5.3.0+) - Gitignore pattern matching
minimatch (10.1.1) - Glob pattern matching for vscodeignore
Acknowledgements
Developed with assistance from:
Thanks to:
- GitSparTV for identifying the running count tracking issue.
- RedCMD for identifying the [a].ts wildcard and trailing tab issues.
Licence
MIT License - Copyright (c) 2025 Jason Gordon
Free to use, modify, and distribute. See LICENSE for details.