How can I search in one subfolder folder of my workspace only?
CTRL+SHIFT+F searches in the whole workspace, and since this is large I get way too many hits in unrelated folders and files.
How can I search in one subfolder folder of my workspace only?
CTRL+SHIFT+F searches in the whole workspace, and since this is large I get way too many hits in unrelated folders and files.
Two options:
This will give you a slightly changed search bar:
Another twist on this is how to search in a collection of named subfolders. For example, consider a directory structure like this:
Project
├── Foo
│ ├── inc
│ │ ├── tom.h
│ │ └── dick.h
│ └── src
│ ├── tom.cpp
| └── dick.c
├── Bar
│ ├── inc
│ │ └── harry.h
│ └── src
│ └── harry.c
The "files to include" box will accept glob
notation, so if the user wants to search only in "src" directories, not in "inc" directories, they can specify:
./**/src/*
This is interpreted (from right to left) as "any file, in a 'src' sub-directory, underneath any directory".
Obviously, this is a trivial example which could be handled by filtering on the file extension, but the principle applies to much more complex searches. For another example, see: https://stackoverflow.com/a/59083215/6419400
There is a ...
under the search box:
After clicking on it, you can specify which files you want to include or exclude from your search results.
You can also use wildcards as shown in the placeholder.
For example, if I write this in the files to include
field:
repo/*.go
then it will show you all
files with .go
extension in repo
folder.
- means all
There is also two other ways to open this option (as Jeroen also mentioned):