Mon - 20 Feb 2006 - 09:29 PM
I've been playing around with two things lately. On the one hand I'm working on a code analysis tool for vs '05, on the other - I'm writing a little app to get rid of perfmon. I've gotten kind of lazy on both, as I'm more in a research phase on them. For perfmon, I put together an app that builds a tree of all counter categories on the machine, and lets you drill down into instances and whatnot. From there, you can drag/drop onto a panel to see the actual counter values. The dead-end there has been a useable chart control. I've been looking on codeproject.com, and other places. While i've found controls with potential, they all seem lacking, and i'm not in the mood to deal with GDI+. In fact, I found one that's perfect - let's you display multiple series at once, vector-based drawing (you can select an individual curve, zoom in, scale, etc.), but it's all MFC/C++ and the comments are in German... there goes that useability factor.
On the code analysis side, I'm playing around with antlr right now - a parser generator. I found a grammar for c# that seems to work, but I haven't figured out how to get it to parse just a code snippet, rather than an entire file. Trying to get a hold of the guy that wrote the grammar, see if he can help me out. Funny thing is that there's plenty of documentation on how to build a parser with antlr, but there's almost none on how to use the end product. Oh well... documentation has always been an issue with open projects...
I'll post more when i have something useful.
No Comments »
Sat - 04 Feb 2006 - 06:36 PM
I was going to post part two of the extensibility wrapper, but i finally figured this out, and thought i'd share before i talk about the other piece. One of the things i've tried to do is to implement the "squigly underline" without having to develop a package just for it. Once you get through all the digging necessary to figure it out, the steps are quite simple. You need to obtan the buffer of your window and then create a marker on it. Sounds simple, right? If you know the steps, then it is; otherwise, you're in for some fun.
So, without further ado, i give you the custom text marker:
private void findCodeWindow(Window window)
{
ServiceProvider sp = new ServiceProvider((IOleServiceProvider)window.DTE);
IVsUIShell shell = (IVsUIShell)sp.GetService(typeof(SVsUIShell));
IEnumWindowFrames frames = null;
IVsWindowFrame[] frameArray = new IVsWindowFrame[window.DTE.Windows.Count];
shell.GetDocumentWindowEnum(out frames);
uint count;
frames.Next(Convert.ToUInt32(window.DTE.Windows.Count), frameArray, out count);
object value;
for (int i = 0; i < count; i++)
{
frameArray[i].GetProperty((int)__VSFPROPID.VSFPROPID_Caption, out value);
if (value.ToString() == window.Caption)
{
frameArray[i].GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out value);
codeWindow = value as IVsCodeWindow;
break;
}
}
}
private IVsTextLineMarker[] markText(int startLine, int startChar, int endLine, int endChar)
{
IVsTextLines lines;
IVsTextLineMarker[] marker = null;
codeWindow.GetBuffer(out lines);
Logger.LogMessage(
String.Format(
"Creating Marker : {0:x}",
lines.CreateLineMarker((int)MARKERTYPE.MARKER_CODESENSE_ERROR, startLine,
startChar, endLine, endChar, null, marker)));
return marker;
}
Let's go through this. The first method (findCodeWindow) uses a standard EnvDTE window object (like the one returned by DTE.ActiveWindow), and obtains a reference to the IVsCodeWindow object that it contains. The second then uses this codewindow to obtain its buffer and create the customer marker.
Let's go through this. The first method (findCodeWindow) uses a standard EnvDTE window object (like the one returned by DTE.ActiveWindow), and obtains a reference to the IVsCodeWindow object that it contains. The second then uses this codewindow to obtain its buffer and create the customer marker.
1 Comment »