提交 cf8168b5 编写于 作者: C CyrusNajmabadi

Simplify the code to set the background color of the tooltip.

上级 c15daa53
......@@ -14,6 +14,8 @@
using Microsoft.CodeAnalysis.Text.Shared.Extensions;
using Microsoft.VisualStudio.LanguageServices.Implementation.Extensions;
using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem;
using Microsoft.VisualStudio.PlatformUI;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.TableControl;
using Microsoft.VisualStudio.Shell.TableManager;
using Microsoft.VisualStudio.Text;
......@@ -140,7 +142,11 @@ private DisposableToolTip CreateDisposableToolTip()
var textBuffer = CreateNewBuffer();
// Create the actual tooltip around the region of that text buffer we want to show.
var toolTip = CreateToolTip(textBuffer);
var toolTip = new ToolTip
{
Content = CreateToolTipContent(textBuffer),
Background = (Brush)Application.Current.Resources[EnvironmentColors.ToolWindowBackgroundBrushKey]
};
// Create a preview workspace for this text buffer and open it's corresponding
// document. That way we'll get nice things like classification as well as the
......@@ -152,21 +158,6 @@ private DisposableToolTip CreateDisposableToolTip()
return new DisposableToolTip(toolTip, workspace);
}
private ToolTip CreateToolTip(ITextBuffer textBuffer)
{
var content = CreateToolTipContent(textBuffer);
var toolTip = new ToolTip { Content = content };
var style = Presenter._presenterStyles.FirstOrDefault(s => !string.IsNullOrEmpty(s.QuickInfoAppearanceCategory));
if (style?.BackgroundBrush != null)
{
toolTip.Background = style.BackgroundBrush;
}
return toolTip;
}
private ContentControl CreateToolTipContent(ITextBuffer textBuffer)
{
var regionSpan = this.GetRegionSpanForReference();
......
......@@ -39,7 +39,6 @@ internal partial class StreamingFindReferencesPresenter :
private readonly ClassificationTypeMap _typeMap;
private readonly IEditorFormatMapService _formatMapService;
private readonly IFindAllReferencesService _vsFindAllReferencesService;
private readonly IEnumerable<QuickInfoPresenterStyle> _presenterStyles;
[ImportingConstructor]
public StreamingFindReferencesPresenter(
......@@ -51,7 +50,6 @@ internal partial class StreamingFindReferencesPresenter :
IContentTypeRegistryService contentTypeRegistryService,
ClassificationTypeMap typeMap,
IEditorFormatMapService formatMapService,
[ImportMany] IEnumerable<QuickInfoPresenterStyle> presenterStyles,
[ImportMany] IEnumerable<Lazy<IAsynchronousOperationListener, FeatureMetadata>> asyncListeners)
{
_serviceProvider = serviceProvider;
......@@ -63,7 +61,6 @@ internal partial class StreamingFindReferencesPresenter :
_textEditorFactoryService = textEditorFactoryService;
_typeMap = typeMap;
_formatMapService = formatMapService;
_presenterStyles = presenterStyles;
_asyncListener = new AggregateAsynchronousOperationListener(
asyncListeners, FeatureAttribute.ReferenceHighlighting);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册