I’m wondering is it possible to search through my entire codebase to find instances of keywords I pass as an array.
Currently I’m using the search feature in vscode but this only allows one word at a time and I’ve got hundreds.
I’m happy to use whatever there is out there, vscode extension, npm package, something I’m able to code myself, just anything to speed this process up.
The codebase I’m wanting to search through is React based.
3
Answers
For this you can use a regular expression (available natively in the search menu of vscode)
Then you can write your query as a regex, for example like this
You can use a quick algorithm to transform your array into this, so you can just copy paste the result
I would recommend using regular expressions. Inside of the vscode project search do this:
and make sure that you have regular expression mode turned on:
You can use regex search in VSCode to find a list of search terms.
Example:
Add regex word boundaries in order to match only that word without matching partial words (ie. the word
data
will match onlydata
and notnewData
, for instance):Remember to turn on regex matching for the search!