Visual Studio Hacks [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Visual Studio Hacks [Electronic resources] - نسخه متنی

Andrew Lockhart

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید







Hack 17. Find Files Quickly

Visual Studio's Solution
Explorer gives you a quick view of your files, but
you'll be able to search through thousands of files
quickly with a free add-in.

The Solution Explorer shows you all of the
files in your solution in an easy-to-use tree. Each project is a
node, and under that node is any number of files and folders. The
Solution Explorer usually works perfectly; however, it starts to fall
short when you have a lot of projects and files. If your solution has
six projects and 500 files, finding one of those files starts to
become quite a task.


3.3.1. Find Files


A free add-in that provides a new interface for finding files
anywhere in your solution is available. It is called the VS
File Finder and can be downloaded from the following link:

http://www.zero-one-zero.com/vs

The first step is to download the add-in and run the installation
file. The installation does not include any choices and can be
completed by simply launching the
.msi file. Once the add-in is installed, it
will show up as a new window the next time you start Visual Studio.
If it does not automatically appear or if you'd like
to show the window again after you close it, you need to click View
VS File Finder, and the window will be displayed. Figure 3-6 shows the VS File Finder interface, which
includes a list of all the files in all the projects in my solution.


Figure 3-6. VS File Finder window

The text box at the top of the window lets you enter any number of
charactersthe list below will be filtered based on what is
entered in the window. Unlike the IntelliSense provided by the
command window, this window will search for the entered string in any
part of the filename. Figure 3-7 shows the string
"Collection" entered in the text
box and the filtering that the tool provides.


Figure 3-7. VS File Finder with results

After the string "Collection" is
entered, the tool shows only the files whose name contains the word
"Collection." This type of
searching is very useful if you maintain common naming conventions in
your project. You can also click on the headings for the list and
sort it based on the name, project, or file.


3.3.2. Exclude Files


The VS File Finder also
includes the ability to exclude certain files from the search list.
If you wanted to exclude all .css files from the
search list, you first need to click on the blue plus sign to the
right of the text box. This brings up the Options screen for VS File
Finder, which is shown in Figure 3-8.


Figure 3-8. VS File Finder Options

Next, you need to click the Add button to see the Add Exclude Filter
dialog, which is shown in Figure 3-9.


Figure 3-9. Add Exclude Filter dialog

Next, you need to enter a description for your exclusion; in this
example, "CSS Files" will work
perfectly. Then you enter your filter (in this example,
.css, which will exclude all CSS files) and
click OK. The filter works a little differently than the search in
that it needs to be an actual extension; it can't be
any part of the filename. After you enter your exclusion filter, all
.css files will be excluded from the search.
This is particularly useful if you include files in your project that
you are not actively working on. For example, you might have a number
of .css files that are part of a company
standard that you would not want to edit and thus can be excluded
from your search list.


3.3.3. Highlight Files


The VS File Finder
add-in provides a method to highlight certain files in the search
list. This is configured in the Options screen that was shown back in
Figure 3-8. To highlight a certain type of file,
you simply need to click the Add button in the Highlighted Files
section. You are then prompted with the Add Highlight Filter dialog,
which is shown in Figure 3-10.


Figure 3-10. Add Highlight Filter dialog

First you need to specify a description of the file type. In this
example, I am going to specify that all .cs
files be highlighted with a particular color and that my description
will be "CS Files." To apply this
to files ending in the .cs extension, you need
to specify .cs in the Filter box. And last, you
need to choose what color to highlight the files with; this is done
by clicking on the color in the box filled with different colors.
After you add this filter, all .cs records will
be highlighted with the selected color. This is a useful technique
for spotting certain types of files in the search list.


3.3.4. Shortcut


During
installation, VS File
Finder also adds a command to Visual Studio. You can use this command
to assign a shortcut key to VS File
Finder. Since this
add-in is about speed, it makes sense to be able to quickly launch
the add-in with a shortcut key, as opposed to using the mouse.

To create a shortcut for VS File Finder, you simply need to wire a
shortcut key to the VSFileFinder.Connect.ShowVSFileFinder command.
For more information on creating shortcuts, see [Hack #24] .

VS File Finder is a very valuable tool that has the capacity to
greatly speed up the search for files in your solutions. VS File
Finder was written by Jonathan Payne and is available at http://www.zero-one-zero.com/vs. The source
code for this add-in is also available from that web site.


/ 172