Click here to Skip to main content
Email Password   helpLost your password?

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:

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

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
GeneralJust want to share my addin
Member 1422316
3:08 17 Feb '09  
http://weblogs.asp.net/pabloretyk/archive/2009/02/12/attach-to-process-for-lazies.aspx[^]
Generalnice work
erehw
19:45 14 Aug '07  
Great work .Thanks a lot.

Just replace these lines in file commands.cpp:
if(access(sFile,0)!=0)
{
DoMessageBox("File " sFile + " does not exist");
return FALSE;
}
with:


if(0=!access(sFile,0))
{

if(0==access(sCurPath+"\\"+sFile,0))

sFile= sCurPath+"\\"+sFile;

}
else
{
DoMessageBox("File " +sCurPath+ "\\"+sFile + " does not exist");
return FALSE;
}

will make it more convenient.Laugh
Generalport to vs2005?
coder66
8:52 23 Jan '07  
Any plans to port this to vs2005? Or has it already been ported?
Generalhelp me
vatavua
3:20 13 Mar '04  
how i can draw a portative with musical notes in word 2003 using c#???
GeneralSuper!
dimcus
21:01 25 Nov '03  
It's just great! I'm working on a large and somewhat messy project (~10000 source files) an this thing helps a lot to navigate through all that stuff (only alternative is Visual SlickEdit that costs some money and, IMHO, not that handy as Visual Studio editor anyway).
It will be really nice to have this addition for Visual Studio .NET Roll eyes ...
GeneralHow do I add this addin to my VS.NET 2003 ?
mvratnam
8:01 26 Sep '03  
Hello, How do I add this addin to my VS.NET 2003 devstudio ?? I don't see a addins directory anywhere in the VS.NET 2003 directories.
GeneralRe: How do I add this addin to my VS.NET 2003 ?
Anna-Jayne Metcalfe
0:14 3 Jan '05  
VS.NET has a different add-in model to VC 5.0/6.0. To get it to work on later versions, it would have to be ported.

Anna Rose

Riverblade Ltd - Software Consultancy Services
Anna's Place | Tears and Laughter
"Be yourself - not what others think you should be"
- Marcia Graesch

"Anna's just a sexy-looking lesbian tart"
- A friend, trying to wind me up. It didn't work.

GeneralExcellent..
Nir Dremer
23:04 12 Jul '03  

good job!
you just improved my productivity...
i'm working on an embedded project and i wanted to use visual studio but the missing support for tags stopped me from this so.
you saved me Smile


thanks

Nir Dremer.
GeneralMSVC6 bookmark
beetung
2:35 10 Nov '02  

Does this serve the same purpose as MSVC6 bookmark. I mean ctl-f2 and shift-f2. What is the key advantage of this add-in??

-dklt
GeneralRe: MSVC6 bookmark
Paul S. Vickery
23:23 10 Nov '02  
Tags are not really like bookmarks. They are more like the browsing facility in MSVC.

For more details on tags and their uses see http://ctags.sourceforge.net/.


---
"The way of a fool seems right to him, but a wise man listens to advice" - Proverbs 12:15 (NIV)
GeneralGood!
Philippe Lhoste
23:30 15 Jul '02  
It is nice and lightweight, I like it...

I added a Tool:
Generate Tags
Command: ctags.exe
(I have it in the path)
Arguments: -f tags *.c *.cpp *.cxx *.cc *.h *.hpp *.hxx *.hh
(I often browse open source projects... You can simplify)
Initial directory: $(CurDir)
Close window on exiting


Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/


Last Updated 23 May 2003 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2010