How to get IVsTextView for a specific OutputWindowPane?

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

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

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

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

+4
source share
1 answer

Of course it is possible. You just need to select the output window window that 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; 
+2
source

Source: https://habr.com/ru/post/1303822/


All Articles