'Open all files present in search result in VScode
Solution 1:[1]
As stated in @Alex's comment, search.action.focusNextSearchResult
is a great match for @NealVDV's use case. It can be run by pressing F4
. It will open each result one after the other in a (writable) preview tab.
F4
(search.action.focusNextSearchResult
) cycles forward through the search resultsShift+F4
(search.action.focusPreviousSearchResult
) cycles backward through the search results
@jakub.g makes the remark that modifying a file in a way that removes them from the search result will make the focusNextSearchResult
pointer restart from the beginning. A solution to this issue is to make sure that either:
- The search result is never removed from the file while it is modified
- The search result is always removed from the file by the modification
Solution 2:[2]
There is this VS Code extension for that: Search - Open All Results
To install it, launch VS Code Quick Open (Ctrl+P) and run
ext install fabiospampinato.vscode-search-open-all-results
Solution 3:[3]
I'm not sure how to do this with a VSCode native tool, but you could do this using VSCode terminal to find the pattern that you're looking for and open all files that match your search pattern. Something like the following:
grep -l "<Icon" * | xargs code
- grep to look for your regex pattern with -l parameter to show only the filename.
xargs
to pass the output as the argument forcode
.
This way you won't have to double click all the files one-by-one.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Wladimir Gramacho |
Solution 3 | Gabriel Ziegler |