Addressed pr feedback, export parts as shared and in the correct layer.

上级 b4ae4fee

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.4
VisualStudioVersion = 15.0.26507.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{A41D1B99-F489-4C43-BBDF-96D61B19A6B9}"
EndProject
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Composition;
using Microsoft.CodeAnalysis.Extensions;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Internal.Log;
namespace Microsoft.CodeAnalysis.Editor.Implementation.Workspaces
{
[ExportWorkspaceService(typeof(IInfoBarService))]
[ExportWorkspaceService(typeof(IInfoBarService)), Shared]
internal class EditorInfoBarService : IInfoBarService
{
public void ShowInfoBarInActiveView(string message, params InfoBarUI[] items)
{
ShowInfoBarInGlobalView(message, items);
}
=> ShowInfoBarInGlobalView(message, items);
public void ShowInfoBarInGlobalView(string message, params InfoBarUI[] items)
{
Logger.Log(FunctionId.Extension_InfoBar, message);
}
=> Logger.Log(FunctionId.Extension_InfoBar, message);
}
}
......@@ -2,7 +2,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Composition;
using System.Linq;
using Microsoft.CodeAnalysis.Editor;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
......@@ -16,15 +16,15 @@
namespace Microsoft.VisualStudio.LanguageServices.Implementation
{
[ExportWorkspaceService(typeof(IInfoBarService))]
[ExportWorkspaceService(typeof(IInfoBarService), layer: ServiceLayer.Host), Shared]
internal class VisualStudioInfoBarService : ForegroundThreadAffinitizedObject, IInfoBarService
{
private readonly IServiceProvider _serviceProvider;
private readonly SVsServiceProvider _serviceProvider;
private readonly IForegroundNotificationService _foregroundNotificationService;
private readonly IAsynchronousOperationListener _listener;
[ImportingConstructor]
public VisualStudioInfoBarService([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider,
public VisualStudioInfoBarService(SVsServiceProvider serviceProvider,
IForegroundNotificationService foregroundNotificationService,
[ImportMany] IEnumerable<Lazy<IAsynchronousOperationListener, FeatureMetadata>> asyncListeners)
{
......@@ -54,7 +54,7 @@ private void ShowInfoBar(bool activeView, string message, params InfoBarUI[] ite
{
CreateInfoBar(infoBarHost, message, items);
}
}, _listener.BeginAsyncOperation("Show InfoBar"));
}, _listener.BeginAsyncOperation(nameof(ShowInfoBar)));
}
private bool TryGetInfoBarData(bool activeView, out IVsInfoBarHost infoBarHost)
......
......@@ -23,6 +23,7 @@ public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
{
_singleton = new VisualStudioErrorReportingService(workspaceServices.GetRequiredService<IInfoBarService>());
}
return _singleton;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册