This article is not so much an introduction to writing add-ins as it is just simply sharing a utility I found very useful for Visual Studio .NET. I primarily use VS.NET / C++ for development, however all our client applications are developed in Delphi 7.0, and I find the GExperts IDE enhancement suite for Delphi very good. Specifically, the ability to go to a function within the current source file. When you invoke the add-in, the above search dialog prompts you to enter a search string. As you type more characters, the list filters all the matches - which is a substring search. So, from the example list above, typing mes would reduce the list to
If there is enough requests, I will fully document the program in this article as a true introduction to VS.NET add-ins.
Don't let the very basic dialog fool you. If you work in source files with a number of functions / members, you will find this add-in quite a time saver when jumping between functions.
This add-in will work with C++, VB.NET and C#. I don't see why it also wouldn't work with Visual J#.
Using the code
I have provided the full source code and an MSI installer, so you can immediately get running. To get the intended benefit from this utility, I recommend you assign it a shortcut (I use CTRL+G, to match the Delphi version). As you type in the search box, the function list will continually reduce. You can use the PGUP/DOWN and UP/DOWN keys without leaving the edit box. Hitting ENTER will centre the function in your editor window.
Points of Interest
The main point of interest is the frmGotoFunction.cs file, which contains all the guts of the app.
It uses the
FileCodeModel object to extract out all the functions from the current source file, however when actually moving the edit point, I had to check if the source file was C++, as the definition and declaration can be separated into a header and source file. If the language is C++, I obtain an interface to the
VCCodeElemet object and use the
StartPointOf method to either get a
TextPoint to the definition if the file extension is ".H" or otherwise to the declaration. This is currently not very robust, so I will investigate further, but currently works for me.
I won't list functions declared in a templated file like STL <list> or one of the ATL files. I haven't yet checked to see why.
Version 1.0 - Initial public release.
I received my first computer, an Atari 800 XL, when I was 8 years old in 1981 and discovered BASIC programming.
Following the Atari a couple of years later, I moved to the Commodore 128D, where I started experimenting with assembler. I progressed through IBM XT, AT, and then all models of clones in between up to the latest P4s. I still dabble in x86 assembler, however my primary development environment today is C++ and C# and to a lesser degree now Delphi 7.0.
I have mostly self taught myself, by example and experimentation although I did receive a Bachelor of Applied Computing at the University of Tasmania / Australia to 'get that piece of paper'.
Professionally, I've been in R&D, consulting, management, sysadmin and training roles since the early 90'. Prior to entering IT professionally, I built a custom application for an abattoir in the late 80's entirely in Turbo Pascal 5.5 to track and report on beef production, due for export to Japan.
I now also enjoy using computers for mixing and recording my own music and satisfying my passion for photography.