Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent visual studio from attempting to search inside PDF file as binary data

My solution has several pdf files that are either served up as static files for download, or bundled into the solution as convenient references for the developer. When searching for small text strings I often get huge numbers of lines of binary-unicode gibberish that floods the search results list. I want a way to exclude pdf files from my search results.

To clarify: I'm aware of the Look at these file types combobox; but I don't want to manually add/remove a whitelist (to avoid problems interfacing with 3rd party systems which produce data with arbitrary extensions). I want to add *.pdf to the black list of files like *.jpg or *.png that VS doesn't attempt to search as if they were text. Something that would allow VS to properly search a .pdf file would be an acceptable alternative.

like image 515
Dan Is Fiddling By Firelight Avatar asked Oct 24 '11 20:10

Dan Is Fiddling By Firelight


1 Answers

I want to add *.pdf to the black list of files like *.jpg or *.png that VS doesn't attempt to search as if they were text.

Use CTRL + SHIFT + F and the following regexp to search for text, such as b:

^\w+b\w+$

Use the PDF prolog to identify PDF files:

^%PDF-1

References

  • Using Regular Expressions in Visual Studio

  • Searching and Navigating Code in Visual Studio 2010

  • Unicode Categories

  • Visual Studio trick to quickly find any file in solution

  • Find in Files: Find Options

  • Improvements to Find All References in Visual Studio 2010

  • PDF File Analyzer

  • Parsing PDF file using Regular expresions in Python

  • Visual Studio 2012 New Features: Solution Explorer

like image 146
Paul Sweatte Avatar answered Oct 17 '22 20:10

Paul Sweatte