public UIElement GetUIElement(Completion itemToRender, ICompletionSession context, UIElementType elementType) { if (RoslynUtilities.IsFinalRoslyn) { // The bug which requires this provider has been fixed return(null); } // only hook when necessary if ((!RoslynUtilities.IsRoslynInstalled(_serviceProvider) ?? true) || !_mefProviderOptions.EnableExtendedXmlCommentsCompletion) { return(null); } if (itemToRender != null && itemToRender.GetType().FullName != "Microsoft.CodeAnalysis.Editor.Implementation.Completion.Presentation.CustomCommitCompletion") { // The Roslyn-provided tool tip provider will throw an exception in this case, so // we override it with the default Visual Studio behavior TextBlock formattableTextBlock = new TextBlock(); formattableTextBlock.Text = itemToRender.Description; formattableTextBlock.MaxWidth = GetScreenRect(context).Width * 0.4; formattableTextBlock.TextWrapping = TextWrapping.Wrap; //formattableTextBlock.TextRunProperties = this._completionTabView.SessionView.PresenterStyle.TooltipTextRunProperties; return(formattableTextBlock); } // allow Roslyn to handle this case return(null); }
public void VsTextViewCreated(IVsTextView textViewAdapter) { // only hook when necessary if ((!RoslynUtilities.IsRoslynInstalled(_serviceProvider) ?? true) || !_mefProviderOptions.EnableExtendedXmlCommentsCompletion) { return; } ITextView textView = _editorAdaptersFactoryService.GetWpfTextView(textViewAdapter); if (textView == null) { return; } RoslynKeyboardFilter filter = new RoslynKeyboardFilter(_completionBroker, textViewAdapter, textView); filter.Enabled = true; textView.Properties.AddProperty(typeof(RoslynKeyboardFilter), filter); }