Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio find - filter by file type?

Is there any way to use Visual Studio's Find and Replace to search only through files of a specified type or types?

If I'm searching through my web project for a particular string, it winds up looking through all my javascript, css and html files when I know all that I'm interested in is results that are in .cs files, for example.

I find myself using Notepad++ which does have the ability to limit its "Find In Files" search to only the file types I specify within the directory I specify, but would love an integrated solution.

like image 816
JustinStolle Avatar asked Mar 08 '11 06:03

JustinStolle


People also ask

How do I filter search by file type?

Search by file type You can use the filetype: operator in Google Search to limit results to a specific file type. For example, filetype:rtf galway will search for RTF files with the term "galway" in them.

How do I search for a specific file type in Visual Studio code?

Click the File Search on the status bar on the bottom of the VSCode IDE. You can also use a keyboard shortcut, Control+Shift+P in Windows or Command+Shift+P on MacOS, to open the command palette and choose Now: Global Search from the list.

How do I filter files in Visual Studio?

In version after VScode 1.70 (July 2022) all you need to do is press Ctrl+F or F3 to search.


2 Answers

Find options

You can choose file types from default or type your own. Regular expressions available for complex search.

like image 179
Altaf Patel Avatar answered Sep 22 '22 13:09

Altaf Patel


In the Find Options, you can specify the settings under "Look at these file types:"

like image 42
sajoshi Avatar answered Sep 21 '22 13:09

sajoshi