Click here to Skip to main content
15,881,715 members
Articles / Desktop Programming / MFC
Article

Tags Visual Studio Add-In

Rate me:
Please Sign up or sign in to vote.
4.78/5 (9 votes)
22 May 2003CPOL4 min read 127.4K   2.1K   37   12
Add-In to add Tags support to Visual Studio

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.

Image 3

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)


Written By
Software Developer (Senior)
United Kingdom United Kingdom
Originally from an electronics background, I moved into software in 1996, partly as a result of being made redundant, and partly because I was very much enjoying the small amount of coding (in-at-the-deep-end-C) that I had been doing!

I swiftly moved from C to C++, and learned MFC, and then went on to real-time C on Unix. After this I moved to the company for which I currently work, which specialises in Configuration Management software, and currently program mainly in C/C++, for Windows. I have been gradually moving their legacy C code over to use C++ (with STL, MFC, ATL, and WTL). I have pulled in other technologies (Java, C#, VB, COM, SOAP) where appropriate, especially when integrating with third-party products.

In addition to that, I have overseen the technical side of the company website (ASP, VBScript, JavaScript, HTML, CSS), and have also worked closely with colleagues working on other products (Web-based, C#, ASP.NET, SQL, etc).

For developing, I mainly use Visual Studio 2010, along with an in-house-designed editor based on Andrei Stcherbatchenko's syntax parsing classes, and various (mostly freeware) tools. For website design, I use Dreaweaver CS3.

When not developing software, I enjoy listening to and playing music, playing electric and acoustic guitars and mandolin.

Comments and Discussions

 
QuestionHow to install on VS2010 Pin
Dhananjay_chopade27-Jan-13 19:31
Dhananjay_chopade27-Jan-13 19:31 
GeneralJust want to share my addin Pin
pablito90117-Feb-09 2:08
pablito90117-Feb-09 2:08 
http://weblogs.asp.net/pabloretyk/archive/2009/02/12/attach-to-process-for-lazies.aspx[^]
Generalnice work Pin
erehw14-Aug-07 18:45
erehw14-Aug-07 18:45 
Questionport to vs2005? Pin
coder6623-Jan-07 7:52
coder6623-Jan-07 7:52 
Generalhelp me Pin
vatavua13-Mar-04 2:20
vatavua13-Mar-04 2:20 
GeneralSuper! Pin
dimcus25-Nov-03 20:01
dimcus25-Nov-03 20:01 
QuestionHow do I add this addin to my VS.NET 2003 ? Pin
mvratnam26-Sep-03 7:01
mvratnam26-Sep-03 7:01 
AnswerRe: How do I add this addin to my VS.NET 2003 ? Pin
Anna-Jayne Metcalfe2-Jan-05 23:14
Anna-Jayne Metcalfe2-Jan-05 23:14 
GeneralExcellent.. Pin
Nir Dremer12-Jul-03 22:04
Nir Dremer12-Jul-03 22:04 
GeneralMSVC6 bookmark Pin
beetung10-Nov-02 1:35
beetung10-Nov-02 1:35 
GeneralRe: MSVC6 bookmark Pin
Paul Vickery10-Nov-02 22:23
professionalPaul Vickery10-Nov-02 22:23 
GeneralGood! Pin
Philippe Lhoste15-Jul-02 22:30
Philippe Lhoste15-Jul-02 22:30 

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.