Creating a simple Addin for PDC Whidbey. SlimeTrail for the the debugger.
(I've updated this post: https://blogs.msdn.com/stevejs/archive/2005/12/21/506477.aspx )
This is the first time I've created an Addin for VS. This one was built using the PDC build of Visual Studio Whidbey. The idea behind this was to make the simplest useful Addin I could. If you have any suggestions on what I else I could have left out let me know. :-)
Step by Step
1. Open VS. Go to File/New/Project. -> Dialog appears.
2. Go to Other Projects -> Extensibility Projects -> Visual Studio .Net Add-in
3. Change the name of the project from MyAddin1 to SlimeTrailAddin, click OK.
4. In the wizard chose C# and next all the way until it says finish.
You will now have a source file open called Connect.cs
5. Find the OnConnection method. It will have two lines of code in it.
6. Add the following to the end of the method:
applicationObject.StatusBar.Text = "SlimeTrail Addin loaded";
applicationObject.Events.DebuggerEvents.OnEnterBreakMode += new _dispDebuggerEvents_OnEnterBreakModeEventHandler(DebuggerEvents_OnEnterBreakMode);
7. Add this member variable to the Connect class:
private System.Collections.Generic.Queue<EditPoint> editPointQueue = new System.Collections.Generic.Queue<EditPoint>();
8. Add the following method:
private void DebuggerEvents_OnEnterBreakMode(dbgEventReason Reason, ref dbgExecutionAction ExecutionAction)
{
TextDocument textDocument = (TextDocument) applicationObject.ActiveDocument.Object("TextDocument");
textDocument.Selection.SetBookmark();
editPointQueue.Enqueue(textDocument.Selection.ActivePoint.CreateEditPoint());
if (editPointQueue.Count > 5)
{
editPointQueue.Dequeue().ClearBookmark();
}
}
9. Compile
10. To use it. Open VS. Tools/Add-in Manager.
11. Check the box next to SlimeTrailAddin. Hit Ok.
You should see "SlimeTrail Addin loaded" appear in the status bar.
When you debug you should get a trail of 5 bookmarks showing the last lines you stopped at.
If you find any issues with this please let me know in the comments.
Comments
- Anonymous
January 29, 2004
The comment has been removed - Anonymous
January 29, 2004
I sadly must agree on your assessment of the docs for VS Addins, at least what I've seen for Whidbey so far. I started answering this with my guess on the reason. However, I'll hold back on that and instead ask around and get a real answer.