Click here to Skip to main content
6,295,667 members and growing! (17,834 online)
Email Password   helpLost your password?
General Programming » Macros and Add-ins » DevStudio Add-ins     Intermediate License: The Code Project Open License (CPOL)

Tags Visual Studio Add-In

By Paul S. Vickery

Add-In to add Tags support to Visual Studio
VC6, VC7Win2K, WinXP, MFC, Dev
Posted:11 Jul 2002
Updated:22 May 2003
Views:82,333
Bookmarked:33 times
Announcements
Loading...
 
Search    
Advanced Search
printPrint   Broken Article?Report       add Share
  Discuss Discuss   Recommend Article Email
13 votes for this article.
Popularity: 5.35 Rating: 4.80 out of 5

1

2

3
1 vote, 11.1%
4
8 votes, 88.9%
5

Introduction

This add-in adds tags support to Visual Studio. It is similar to my Visual Studio macro Adding tags support to Visual Studio, but it is implemented as an add-in, which makes it more robust, and offers the user a choice if the tag is found more than once in the tags file. It also allows the specification of a default tags file, and includes case-matching and partial-matching options.

One reason I prefer using tags as opposed to the built-in Browse facilities is that I use other editors (Lemmy, and our own in-house editor) which use tags. Another advantage is that I can build my tags files at any time, without my code needing to be compilable.

To use the add-in, simply put it in the Common\MSDev98\AddIns directory under where-ever your Visual Studio is installed. Going to Tools | Customize, and picking the Add-ins and Macro Files tab will then list Tags Developer Studio Add-In as an available add-in. Turning on the add-in will add a new toolbar.

The toolbar will contain the following buttons:

  • Push Tag
  • Pop Tag
  • Push Tag Prompt
  • Clear Tag Stack
  • Tag Options
  • Edit Tag Stack

Clicking the Push Tag button will retrieve the selected text, or pick the current word if no text is selected, and look in the appropriate tags file to see if the tag exists. The tags file is first sought in the current file's directory, and if none is present the default tags file is used if specified, else the user is told that a tags file was not found. Once the tag is found, the add-in will jump to its location, or if there is more than one entry, will offer the user a list of possible locations to jump to, using the dialog shown below.

Tags Add-In

The list of tag entries may be sorted by any of the columns to make it easier to find the required tag location. Double-clicking an item, or selecting an item and clicking OK, will jump you to the tag.

The Push Tag Prompt button can be used to open the tag dialog and search for a tag by typing its name. You may override the case-sensitivity and partial match options for this search if you wish.

The Pop Tag button will jump you back to where you were, when the last tag was jumped to. If you have not jumped to a tag, or if you have 'popped' right back to your first location, then a message will tell you that the tag stack is empty. You may prevent these messages by switching off the Show messages option in the options dialog.

You may clear the tag stack at any time by clicking the Clear Tag Stack button. A message will tell you that the stack has been cleared, or that the stack is empty, unless you have switched off the Show messages option in the options dialog.

The add-in options are available by clicking the Tags Options button, and are shown in the following dialog:

Tags Add-In Options

Clicking the Edit Tag Stack button produces a dialog as shown below, which allows the tag stack to be edited.

You may jump to a location by double-clicking an item, or by selecting an item and clicking OK. Stack entries may be deleted by selecting one or more entries and clicking the Delete Entry button, or by hitting the Del key. The entire stack may also be cleared by clicking Clear Stack, whereupon the dialog will be closed.

Tag file generation

To generate my tags I use Exuberant Ctags, by Darren Hiebert. This is available as a free download from http://ctags.sourceforge.net/. The download location includes information on the options for generating tags.

Reading the tags file

The code used for reading the tags file is written by Darren Hiebert, and is included in the tags download mentioned above. The functions are defined in a file called readtags.c. They read the tags file each time a tag is searched for. These are very fast functions, and are, in my opinion, far better than reading the file into a map, list, or array, and keeping a list of tags files.

Credits

Whilst none of the code was taken from other sources (with the exception of the tag reading code mentioned above), the idea for the tag selection dialog was taken from Joshua Jensen's Workspace Utilities v1.75.

History

  • Version 2.0 - 23 May 2003
    • Added sorting to tag list in prompt dialog
    • Added option to not show messages when clearing the tag stack etc.
    • Added dialog for editing the tag stack
  • Version 1.0 - 12 Jul 2002
    • First version

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Paul S. Vickery


Member
Originally from an electronics background, Paul moved into software in 1996, partly as a result of being made redundant, and partly because he was very much enjoying the small amount of coding (in-at-the-deep-end-C) that he had been doing (the only programming he had done prior to that was a little Pascal, and ZX Spectrum Basic!).

Paul swiftly moved from C to C++, and learned MFC, and then went on to real-time C on Unix. After this he moved to the company for which he currently works, which specialises in Configuration Management, and programs in C/C++, for Windows. He has been gradually moving their legacy C code over to C++/MFC, pulling in other new technologies as he goes where appropriate.

Paul uses Visual Studio 2005, his own in-house-designed editor based on Andrei Stcherbatchenko's syntax parsing classes, and various other freeware tools.

Occupation: Software Developer (Senior)
Location: United Kingdom United Kingdom

Other popular Macros and Add-ins articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 11 of 11 (Total in Forum: 11) (Refresh)FirstPrevNext
GeneralJust want to share my addin PinmemberMember 14223163:08 17 Feb '09  
Generalnice work Pinmembererehw19:45 14 Aug '07  
Generalport to vs2005? Pinmembercoder668:52 23 Jan '07  
Generalhelp me Pinmembervatavua3:20 13 Mar '04  
GeneralSuper! Pinmemberdimcus21:01 25 Nov '03  
GeneralHow do I add this addin to my VS.NET 2003 ? Pinmembermvratnam8:01 26 Sep '03  
GeneralRe: How do I add this addin to my VS.NET 2003 ? PinmemberAnna-Jayne Metcalfe0:14 3 Jan '05  
GeneralExcellent.. PinmemberNir Dremer23:04 12 Jul '03  
GeneralMSVC6 bookmark Pinmemberbeetung2:35 10 Nov '02  
GeneralRe: MSVC6 bookmark PinmemberPaul S. Vickery23:23 10 Nov '02  
GeneralGood! PinmemberPhilippe Lhoste23:30 15 Jul '02  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 22 May 2003
Editor: Chris Maunder
Copyright 2002 by Paul S. Vickery
Everything else Copyright © CodeProject, 1999-2009
Web15 | Advertise on the Code Project