public IWpfTextViewHost GetCurrentViewHost(Func <string, bool> predicate) { IWpfTextViewHost viewHost = VisualStudioInteraction.GetCurrentViewHost(_serviceProvider); if (viewHost == null) { return(null); } ITextDocument textDocument = viewHost.GetTextDocument(); if (textDocument == null || !predicate(textDocument.FilePath)) { return(null); } return(viewHost); }
public static IWpfTextViewHost GetCurrentViewHost(IServiceProvider serviceProvider, Func <string, bool> predicate) { IWpfTextViewHost viewHost = GetCurrentViewHost(serviceProvider); if (viewHost == null) { return(null); } ITextDocument textDocument = viewHost.GetTextDocument(); if (textDocument == null || !predicate(textDocument.FilePath)) { return(null); } return(viewHost); }
static IWpfTextViewHost GetCurrentVBViewHost(IServiceProvider serviceProvider) { IWpfTextViewHost viewHost = VisualStudioInteraction.GetCurrentViewHost(serviceProvider); if (viewHost == null) { return(null); } ITextDocument textDocument = viewHost.GetTextDocument(); if ((textDocument == null) || !IsVBFileName(textDocument.FilePath)) { return(null); } return(viewHost); }