CSS Selector Search
Search for HTML elements in your codebase like you would in css files, using :

Features
CSS selector queries
Find elements with selectors such as div.card > span, button[type="submit"], or label.field > span in the sidebar view
Include / exclude files
Limit which files are scanned (defaults: *.html,*.ts include; workspace .gitignore exclude)
Native Partial Angular Support
[class.foo] → class foo
[prop] / [attr.title] → attributes
(click) → attribute click
[(ngModel)] → attribute (HTML-lowercased)
Searching with Angular Compiler
If toggled, instead of plain html, the DOM is built with the Angular Compiler. Helpful for searching through a more accurate DOM tree, but much slower and only searches in templates (inline or templateURL)
Skip large files
Toggle on by default; files over 512 KB are not parsed.
Command palette
Command: CSS Selector Search: Search (css-selector-search.search)
- From the Command Palette (no args): enter a selector → results open in a QuickPick → pick a match to open the file. Include / exclude and flags come from Settings.
- Programmatically: pass an object with at least
selector. Returns a JSON result list (no UI).
const results = await vscode.commands.executeCommand('css-selector-search.search', {
selector: 'div.card > span',
include: '*.html,*.ts', // optional
exclude: '**/dist/**', // optional
useGitIgnore: true, // optional
useAngularCompiler: false, // optional
skipLargeFiles: true, // optional
});
Success return value:
{
selector: string;
include: string;
exclude: string;
fileCount: number;
matchCount: number;
skippedLargeFiles: number;
files: Array<{
path: string;
uri: string;
matches: Array<{ line: number; preview: string }>;
}>;
}
Failure: { cancelled: true } or { error: string }.
Extension Settings
Defaults for the search command (Settings → “CSS Selector Search”). The sidebar keeps its own include / exclude fields.
| Setting |
Default |
Description |
cssSelectorSearch.include |
*.html,*.ts |
Include globs (comma-separated) |
cssSelectorSearch.exclude |
"" |
Exclude globs (comma-separated) |
cssSelectorSearch.useGitIgnore |
true |
Respect .gitignore via ripgrep |
cssSelectorSearch.useAngularCompiler |
false |
Parse with the Angular compiler |
cssSelectorSearch.skipLargeFiles |
true |
Skip files over 512 KB |
Resolution for the command: arg → setting → hard-coded default.