Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to search for just a specific file type in Visual Studio code?

In Visual Studio code, how do I search for just a specific file type (i.e. *.css or *.ts)?

PS: I'm talking about the global search (Ctrl+Shift+F in Windows)

I'm already using the "files to include" as a folder filter. So currently it has something like ./src/app.

like image 737
Wagner Danda da Silva Filho Avatar asked Oct 05 '17 15:10

Wagner Danda da Silva Filho


People also ask

How do I search for a file type in VS Code?

Search across files# VS Code allows you to quickly search over all files in the currently opened folder. Press Ctrl+Shift+F and enter your search term. Search results are grouped into files containing the search term, with an indication of the hits in each file and its location.

How exclude files from VS Code search?

Persistent Exclusions From menu choose File ➡️ Preferences ➡️ Settings ➡️ User/Workspace Settings and filter default settings to search . You can modify the search. exclude setting (copy from default setting to your user or workspace settings). That will apply only to searches.


2 Answers

Click the ellipses on the bottom right to display the "files to include" field.

You can specify a particular type with "*.filetype".

E.g.

screenshot

like image 135
Blorgbeard Avatar answered Oct 03 '22 09:10

Blorgbeard


You can do this.

./src/app/**/*.ts 

other glob syntax

  • * to match one or more characters in a path segment
  • ? to match on one character in a path segment
  • ** to match any number of path segments, including none
  • {} to group conditions (for example {**/*.html,**/*.txt} matches all HTML and text files)
  • [] to declare a range of characters to match (example.[0-9] to match on example.0, example.1, …)
like image 32
MohitGhodasara Avatar answered Oct 03 '22 11:10

MohitGhodasara