Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the IVsTextView of a specific OutputWindowPane?

I have a visual studio integration package that tracks output from the debug window. I can get the IVsTextView of the output window, like so:

IVsTextView view = GetService(typeof(SVsOutputWindow)) as IVsTextView;
// grab text from the view and process it

However, if a different panel other than the "Debug" panel is currently active, then this IVsTextView will have text from that panel, and not the "Debug" panel.

Is it possible to get an IVsTextView for a specific output window panel, without calling OutputWindowPanel.Activate() prior to getting the IVsTextView of the output window?

like image 552
Jeremy Bell Avatar asked Nov 05 '22 15:11

Jeremy Bell


1 Answers

Sure, it's possible. You just need to select the output window pane you want to read:

IVsOutputWindow outWindow = GetService(typeof(SVsOutputWindow)) as IVsOutputWindow;
// Give me the Debug pane
Guid debugPaneGuid = VSConstants.GUID_OutWindowDebugPane;
IVsOutputWindowPane pane;
outWindow.GetPane(ref debugPaneGuid, out pane);
// Get text view and process it
IVsTextView view = pane as IVsTextView;
like image 137
Oleg Tkachenko Avatar answered Nov 14 '22 23:11

Oleg Tkachenko