private static IOleCommandTarget GetFilterByFullClassName(CommandChainNodeWrapper commandChainWrapper, string className, int levelDeep) { if (commandChainWrapper.FilterObject != null && commandChainWrapper.FilterObject.GetType().FullName == className) { return(commandChainWrapper.FilterObject as IOleCommandTarget); } if (levelDeep >= LevelDeepMax) { return(null); } if (commandChainWrapper.Next != null) { try { return(GetFilterByFullClassName(commandChainWrapper.Next, className, ++levelDeep)); } catch (Exception ex) { Debug.WriteLine(ex); return(null); } } return(null); }
public void VsTextViewCreated(IVsTextView textViewAdapter) { ITextView textView = AdapterService.GetWpfTextView(textViewAdapter); if (textView == null) { return; } var fsiViewFilter = CommandChainNodeWrapper.GetFilterByFullClassName(textViewAdapter, FsiLanguageServiceHelper.FsiViewFilterClassName); if (fsiViewFilter == null) { return; // I didn't find a btter way to figure out if this IVsTextView is indeed F# interactive. } this.TextView = textView; FsiLanguageServiceHelper fsiLanguageServiceHelper = new FsiLanguageServiceHelper(); fsiLanguageServiceHelper.StartRegisterAutocompleteWatchdogLoop(); Func <FSharpCompletionCommandHandler> createCommandHandler = delegate() { return(new FSharpCompletionCommandHandler(textViewAdapter, textView, this)); }; textView.Properties.GetOrCreateSingletonProperty(createCommandHandler); }
private static IOleCommandTarget GetFilterByFullClassName(CommandChainNodeWrapper commandChainWrapper, string className, int levelDeep) { if (commandChainWrapper.FilterObject != null && commandChainWrapper.FilterObject.GetType().FullName == className) { return commandChainWrapper.FilterObject as IOleCommandTarget; } if (levelDeep >= LevelDeepMax) { return null; } if (commandChainWrapper.Next != null) { try { return GetFilterByFullClassName(commandChainWrapper.Next, className, ++levelDeep); } catch (Exception ex) { Debug.WriteLine(ex); return null; } } return null; }
internal FSharpCompletionCommandHandler(IVsTextView textViewAdapter, ITextView textView, FSharpCompletionHandlerProvider fsharpCompletionHandlerProvider) { this.m_textView = textView; this.m_provider = fsharpCompletionHandlerProvider; this.dte = this.m_provider.ServiceProvider.GetService(typeof(EnvDTE.DTE)) as EnvDTE.DTE; textViewAdapter.AddCommandFilter(this, out m_nextCommandHandler); Task.Delay(2000).ContinueWith((a) => { // Probably it is possible to find it through package as well. this.fsiToolWindow = CommandChainNodeWrapper.GetFilterByFullClassName(textViewAdapter, FsiLanguageServiceHelper.FsiToolWindowClassName); }); this.textViewAdapter = textViewAdapter; }
public static IOleCommandTarget GetFilterByFullClassName(IVsTextView textAdapter, string className) { CommandChainNodeWrapper commandChainWrapper = new CommandChainNodeWrapper(textAdapter); return(GetFilterByFullClassName(commandChainWrapper, className, 0)); }
public static IOleCommandTarget GetFilterByFullClassName(IVsTextView textAdapter, string className) { CommandChainNodeWrapper commandChainWrapper = new CommandChainNodeWrapper(textAdapter); return GetFilterByFullClassName(commandChainWrapper, className, 0); }