Click here to Skip to main content
15,879,474 members
Articles / Programming Languages / C#
Article

How We Use SlickEdit® Tools for Microsoft® Visual Studio® 2005

14 May 200712 min read 30.7K   9   2
Describes how we use some of our favorite features from our own Tools® plug-in product.

This article is in the Product Showcase section for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers.

This is a showcase review for our sponsors at The Code Project. These reviews are intended to provide you with information on products and services that we consider useful and of value to developers.

Introduction

Have you ever bought a fishing pole? The manual that comes with it will show you how to put it together, how to release the line, change the spool, and many other important functional points about the fishing pole. But it won't teach you to how to fish.

We've written previous Code Project articles that show what features are included in our SlickEdit® Tools for Microsoft® Visual Studio® 2005 product. It's not just marketing talk when we say that we use our products daily in our own software development. This article describes how we use those tools at SlickEdit. A trial version of the product may be downloaded by clicking this link.

Quick Links

Auto Code Doc Viewer

Screenshot - screenshot.gif[Screenshot] Screenshot - returntop.gif[Back to top]

On the surface, the Auto Code Doc Viewer looks like it performs the same function as NDoc or Sandcastle. All of these tools are used to build linked Help for a code base, but Auto Code Doc Viewer is the only one that truly integrates that Help with Visual Studio.

Auto Code Doc Viewer does not use assemblies or reflection to build its Help pages. Instead, it crawls through the source code to build the documentation database. The result is an XML file with very rich information about the source code structure, including the header comments for all source code elements. It then uses this XML document to build Help pages on the fly as you browse them in the viewer.

Because of this, it works with managed and unmanaged code, including C++ and Web projects. It can even build documentation if the source code doesn't compile. XMLdoc is parsed to build rich Help if it exists, but if you use block or line comments to document your classes and functions, it will extract them as well.

Every documented symbol from classes to member variables has a special "code link" icon beside it. Clicking that icon takes you directly to the source code for that entity. This bridges the gap between the documentation and the source code.

How do we use it?

For me, Auto Code Doc Viewer is great for providing a high level view for a code base that's new to me. I use it for the following:

  1. If another developer adds a new module to the project or solution, it gives me an easy way to get an overview of it without browsing the source code directly. Once I'm ready to go to the source code, I use the code link for a particular class or function I'm interested in to take me there directly.
  2. I love Code Project for learning new things. Sometimes, though, it's challenging to open completely unknown source code and start making sense of it. Whenever I download the source code from a Code Project article, Auto Code Doc Viewer is the first thing I use to get a high-level view of what's going on. It's a great starting point for digging down into the source code.

To try this out, do the following

  1. Open a Code Project sample application.
  2. Open the Auto Code Doc Viewer tool window by choosing SlickEdit > Show Auto Code Doc Viewer.
  3. The viewer window will appear as a tabbed document, populated with a link for the project.
  4. By clicking on that link, you can drill down into the namespaces, classes, functions, etc. defined in that project.
  5. You can also browse the classes, functions, properties, etc. by using the indexes at the top of the page.
Screenshot - clapper.gifWatch Auto Code Doc Viewer in action...

Comment Wrapping

Screenshot - screenshot.gif[Screenshot] Screenshot - returntop.gif[Back to top]

Can you imagine writing a text document in an editor that didn't word wrap? Unfortunately, as programmers, we do it lots of times every day. When we write code, we want a code editor which doesn't word wrap. However, when we write comments, there's no reason why the editor shouldn't word wrap. How many times have you edited a comment and then had to manually adjust the right side to keep the code well formatted?

Comment wrapping enhances the code editor to word wrap comments as you type. Wrapping works with any type of multi-line comment: line comments, block comments, and XMLdoc and Javadoc comments. It can even reformat existing comment blocks to your preferred layout.

How do we use it?

The ease of writing comments with this tool is obvious. However, I've noticed over time that using this feature has made me a much more effective comment writer because it takes all of the tedious work out of the text formatting. Our source code has become much better documented because of it.

To try this out, do the following

  1. Open a source code file for editing.
  2. Type /// on the line above a function header (''' for VB).
  3. A skeleton XMLdoc comment will be created.
  4. Position the cursor inside the <summary> tag and start typing.
  5. The text will start wrapping once the comment width is greater than 80 characters.

NOTE: This is the default behavior. There are many options available for defining how you want your comments to wrap.

Screenshot - clapper.gifWatch Comment Wrapping in action...

Directory Aliases

Screenshot - returntop.gif[Back to top]

A directory alias is a short identifier for a full directory path. For instance, winsys might be a directory alias for C:\windows\system32. Whenever you use the Open or Save dialogs in Visual Studio, type a directory alias and expand it with the Ctrl+Dot key sequence, then press Enter to go there directly. You'll never need to double-click your way through those dialogs again.

How do we use it?

There are a handful of directories that I'm always browsing to when I use the Open or Save dialogs in Visual Studio. Some of the directories that I always have aliases for:

  • Our development root directory
  • Any output or log directory
  • C:\Windows\System32
  • My personal temp directory
  • Our documentation directory

To try this out, do the following

  1. Select the File > Open > File menu option (Ctrl+O) to show the Open File dialog.
  2. Place the cursor in the File name entry field, and type wd.
  3. Press Ctrl+Space. The wd is replaced with C:\Windows (or whatever your %WINDIR% environment variable is defined as).
  4. Press Enter, and you are now in the C:\Windows directory.
Screenshot - clapper.gifWatch Directory Aliases in action...

Icon Extractor

Screenshot - screenshot.gif[Screenshot] Screenshot - returntop.gif[Back to top]

The icon extractor is a great tool in two ways: finding quality icons and applying them easily. Many icons can be obtained by browsing any EXE or DLL (managed or unmanaged). For instance, Windows\System32\shell32.dll has lots of great icons. There are many other binary files from which icons can be extracted. Regular icons and images may also be loaded, as well as icon libraries. The C:\Program Files\Microsoft Visual Studio 8\Common7\VS2005ImageLibrary\bitmaps folder of Visual Studio has a huge number of very good images to use on controls. It can also be used to retrieve icons common to your applications. By opening up the binary form of other applications you've developed, you'll have access to the same set of icons to give a similar look and feel.

Perhaps even more important is the ease with which extracted icons and images may be applied to the forms designer. The toolbar has a button to refresh the tool's designer component tree. This populates a tree that shows a categorized view of the controls in your form designer, including buttons, menus, toolbar buttons, and anything that accepts an image. You may then simply drag and drop icons from the collection onto the items in the designer control tree. They are updated instantly on the form designer's UI. If you've ever had to assign lots of images to menu items, you know what a long, lousy job that is. Now, it's as easy as drag-and-drop.

How do we use it?

I always use the Icon Extractor to assign the images to my controls. I start by loading the images from our binaries and picking from that list. If there's no match in that set, then I usually open up shell32.dll. The drag-and-drop application of those images actually makes the task enjoyable. It's fun to crack open lots of binaries and see what great icons are inside!

To try this out, do the following:

  1. Open the Icon Extractor tool window by choosing SlickEdit > Show Icon Extractor.
  2. Click on the Open toolbar button.
  3. Browse to C:\Windows\System32. Select and open the file shell32.dll. The icon window will be loaded with the 200+ icons that are embedded in that DLL.
  4. Create a new Windows application project by choosing File > New > Project.
  5. Open the GUI editor for the main form and close it's code view if it's open. Put a button on the form and set the ImageAlign property to MiddleLeft.
  6. Click the Refresh Designer Component Tree button on the Icon Extractor's toolbar. The tree will be populated with the components on the designer form.
  7. Drag an icon from the icon window onto the button's node in the tree. That icon will be assigned to it both in the tree and in the designer. This works for any control that accepts a graphic or icon, including menus and toolbars.

Note: Please check all licensing terms before using any copyrighted materials.

Screenshot - clapper.gifWatch the Icon Extractor in action...

Word Completions

Screenshot - returntop.gif[Back to top]

Intellisense® is wonderful when it works, but sometimes it can be incomplete or simply not there at all. The Word Completions feature of SlickEdit Tools is extremely helpful when Intellisense is out to lunch. The concept is simple; most of the results you get in Intellisense are symbols that you've already typed elsewhere in the file. The Complete Previous command is bound to the key sequence Ctrl+Shift+Comma. When this key sequence is pressed, Word Completions finds the first prior word in the file that is a prefix match for what you have started typing. For instance, take the following code sample:

C++
long CModel1DataAccess::Init(LPCTSTR loggingModuleName)
{
    lo|

The | represents where the cursor is. You could use Intellisense's Ctrl+Space to get a list of completions, but the list is huge and "loggingModuleName" appears a long way down the list. Using Word Completions, Ctrl+Shift+Comma immediately completes to "loggingModuleName" and highlights where it found the match. If we want to keep searching backwards for more "lo" matches, you can keep pressing Ctrl+Shift+Comma. The next match is "long", the return type for the function.

How do we use it?

At SlickEdit, we do a lot of work in Visual Studio that falls outside the abilities of Intellisense. In these situations, Word Completions saves an unbelievable amount of time. Despite its simplicity, the Word Completions feature is addictive. Once you use it a few times, you'll find yourself using it more than Intellisense.

To try this out, do the following:

  1. Open a Code Project sample application.
  2. Create a blank line at the end of any function and put the cursor there.
  3. Type the first few letters of any symbol in the function and press Ctrl+Shift+Comma
  4. Word Completions will auto-complete the word and highlight where it was found.

Diff With...

Screenshot - screenshot.gif[Screenshot] Screenshot - returntop.gif[Back to top]

SlickEdit Tools comes with DIFFzilla®, which allows you to compare files side-by-side. There are many differencing tools available, but what makes DIFFzilla special is its ability to diff the current buffer with many different sources. DIFFzilla allows line and block differences to be merged, and you can make live edits inside the diff buffers. You can then save the results directly back to the associated Visual Studio editor, or to a text file.

Here is a summary of the diff functions you can do on the current buffer:

  • Diff with disk file: Diffs the contents of the current buffer with the contents of that buffer's file. This is an extremely convenient way to find out what changes you have made since you last saved the file, and to be able to merge those changes back if necessary. You can perform this function by right clicking on an editor tab and clicking Diff with disk file.
  • Diff with Backup History: If you are using SlickEdit Tools Backup History to maintain versions for all file saves, you may select a version in the list and click Run diff on selected backup. This diffs the contents of the current buffer with the selected Backup History version. This is another great way to see what changes you've made from a specific point in time and be able to roll them back.
  • Diff with CVS or SourceSafe: DIFFzilla can be set up to work with CVS or Visual SourceSafe® 2005 via the Options page. Doing so will allow you to right-click on any source-controlled file in the current solution and select Diff with CVS or Diff with SourceSafe depending on your source control system. DIFFzilla will show a dialog with a list of versions from which you can pick. If the file is open in an editor, DIFFzilla will diff that version with the open buffer. If not, DIFFzilla will diff that version with the file on disk.

How do we use it?

I use the Diff with disk file so often it's starting to wear out. I re-bound it to the Ctrl+Shift+/ key sequence to avoid having to right-click to see this view. I always use Backup History as well so that when I paint myself into a corner with a file, I don't have to go all the way back to the last time that file was checked in.

To try this out, do the following

  1. Open DIFFzilla directly by choosing SlickEdit > Diff.
  2. Open any file for editing.
  3. Change the contents of the editor buffer.
  4. Right-click on the editor tab and click Diff with Disk File.
  5. The editor contents and the disk file will be diffed.
  6. You can merge the contents and save the results directly back to the associated Visual Studio editor.

Take it For a Spin

Screenshot - returntop.gif[Back to top]

At SlickEdit, we are confident that you will be as excited as we are about the latest release of SlickEdit Tools for Microsoft Visual Studio 2005. Download the trial version and try it out for yourself.

Download the trial of SlickEdit Tools for Microsoft Visual Studio 2005

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
SlickEdit Inc. provides software developers with multi-language development tools and the most advanced code editors available. Power programmers, from Fortune 500 companies to individuals, have chosen SlickEdit as their development tool of choice for over 19 years. Proven on Windows, Linux, UNIX, and Mac OS X platforms, SlickEdit products enable even the most accomplished developers to write more code faster, and more accurately. For more information about SlickEdit and free trial downloads, please visit http://www.slickedit.com.
This is a Organisation

1 members

Comments and Discussions

 
GeneralQuick profiling within an unmanaged MFC application Pin
Ahmed Charfeddine29-Dec-07 1:40
Ahmed Charfeddine29-Dec-07 1:40 
GeneralRe: Quick profiling within an unmanaged MFC application Pin
SlickEdit Inc.3-Jan-08 2:22
SlickEdit Inc.3-Jan-08 2:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.