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); }
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; }