vscode extension to configure search presets
Sometimes you want to search through a specific set of files, you can use vscode's search include/exclude configurations to filter the results.
There are some common workflows that are repeated throughout your day, like searching only test files, only source files, only package.json
files, etc.
This extension lets you configure presets which configure your search by typing a single command.
Use the command palette and type Search Presets
Or use one of the shortcuts:
- Windows:
Shift + Alt + F
- Mac:
Shift + Alt + F
It will resolve the query in the following order
- A query which is configured for the preset.
- Highlighted text in VSCode.
- Clipboard text
- Empty query
Unfortunatly at the moment, there is no API for reading the current query in the search widget
Files to include in the search
Files to exclude from the search
Match Case (Aa)
Match Whole Word (ab)
Use Regular Expressions (.*)
Trigger search after selecting a preset
Enforce a specific search query
null means that the preset will not override the existing search configuration
"search-presets.custom": {
[PresetName]": {
"filesToInclude": string | null,
"filesToExclude": string | null,
"isCaseSensitive": boolean | null,
"matchWholeWord": boolean | null,
"isRegex": boolean | null,
"triggerSearch": boolean | null,
"query": string | null
}
}
Apply as defaults for all preset configurations
"search-presets.isCaseSensitive": boolean | null,
"search-presets.matchWholeWord": boolean | null,
"search-presets.isRegex": boolean | null,
"search-presets.triggerSearch": boolean | null
If you don't configure anything, this are the presets you'll get
"search-presets.custom": {
"Tests": {
"filesToInclude": ".test.*, .spec.*, .e2e.*, .driver.*"
},
"Source Files": {
"filesToExclude": "*.test.js, *.driver.*, *.json"
},
"package.json": {
"filesToInclude": "package.json"
}
}