提交 7013549f 编写于 作者: C CyrusNajmabadi

Make type nested

上级 b81e3004
......@@ -183,7 +183,7 @@
<Compile Include="Shared\LogicalStringComparer.cs" />
<Compile Include="Shared\VisualStudioImageMonikerService.cs" />
<Compile Include="SolutionEventMonitor.cs" />
<Compile Include="SymbolSearch\VisualStudioSymbolSearchLogService.cs" />
<Compile Include="SymbolSearch\VisualStudioSymbolSearchService.LogService.cs" />
<Compile Include="Telemetry\CodeMarkerLogger.cs" />
<Compile Include="Telemetry\ProjectTypeLookupService.cs" />
<Compile Include="Telemetry\ProjectTelemetryIncrementalAnalyzerProvider.cs" />
......
// 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.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.SymbolSearch;
using Microsoft.VisualStudio.Shell.Interop;
using Roslyn.Utilities;
namespace Microsoft.VisualStudio.LanguageServices.SymbolSearch
{
internal class VisualStudioSymbolSearchLogService : ForegroundThreadAffinitizedObject, ISymbolSearchLogService
{
private static readonly LinkedList<string> s_log = new LinkedList<string>();
private readonly IVsActivityLog _activityLog;
public VisualStudioSymbolSearchLogService(IVsActivityLog activityLog)
{
_activityLog = activityLog;
}
public Task LogInfoAsync(string text)
{
return LogAsync(text, __ACTIVITYLOG_ENTRYTYPE.ALE_INFORMATION);
}
public Task LogExceptionAsync(string exception, string text)
{
return LogAsync(text + ". " + exception, __ACTIVITYLOG_ENTRYTYPE.ALE_ERROR);
}
private Task LogAsync(string text, __ACTIVITYLOG_ENTRYTYPE type)
{
Log(text, type);
return SpecializedTasks.EmptyTask;
}
private void Log(string text, __ACTIVITYLOG_ENTRYTYPE type)
{
if (!this.IsForeground())
{
this.InvokeBelowInputPriority(() => Log(text, type));
return;
}
AssertIsForeground();
_activityLog?.LogEntry((uint)type, SymbolSearchUpdateEngine.HostId, text);
// Keep a running in memory log as well for debugging purposes.
s_log.AddLast(text);
while (s_log.Count > 100)
{
s_log.RemoveFirst();
}
}
}
}
\ No newline at end of file
// 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.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.SymbolSearch;
using Microsoft.VisualStudio.Shell.Interop;
using Roslyn.Utilities;
namespace Microsoft.VisualStudio.LanguageServices.SymbolSearch
{
internal partial class VisualStudioSymbolSearchService
{
private class LogService : ForegroundThreadAffinitizedObject, ISymbolSearchLogService
{
private static readonly LinkedList<string> s_log = new LinkedList<string>();
private readonly IVsActivityLog _activityLog;
public LogService(IVsActivityLog activityLog)
{
_activityLog = activityLog;
}
public Task LogInfoAsync(string text)
{
return LogAsync(text, __ACTIVITYLOG_ENTRYTYPE.ALE_INFORMATION);
}
public Task LogExceptionAsync(string exception, string text)
{
return LogAsync(text + ". " + exception, __ACTIVITYLOG_ENTRYTYPE.ALE_ERROR);
}
private Task LogAsync(string text, __ACTIVITYLOG_ENTRYTYPE type)
{
Log(text, type);
return SpecializedTasks.EmptyTask;
}
private void Log(string text, __ACTIVITYLOG_ENTRYTYPE type)
{
if (!this.IsForeground())
{
this.InvokeBelowInputPriority(() => Log(text, type));
return;
}
AssertIsForeground();
_activityLog?.LogEntry((uint)type, SymbolSearchUpdateEngine.HostId, text);
// Keep a running in memory log as well for debugging purposes.
s_log.AddLast(text);
while (s_log.Count > 100)
{
s_log.RemoveFirst();
}
}
}
}
}
\ No newline at end of file
......@@ -36,7 +36,7 @@ internal partial class VisualStudioSymbolSearchService : AbstractDelayStartedSer
private readonly VisualStudioWorkspaceImpl _workspace;
private readonly IPackageInstallerService _installerService;
private readonly string _localSettingsDirectory;
private readonly VisualStudioSymbolSearchLogService _logService;
private readonly LogService _logService;
private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
......@@ -52,7 +52,7 @@ internal partial class VisualStudioSymbolSearchService : AbstractDelayStartedSer
_installerService = workspace.Services.GetService<IPackageInstallerService>();
_localSettingsDirectory = new ShellSettingsManager(serviceProvider).GetApplicationDataFolder(ApplicationDataFolder.LocalSettings);
_logService = new VisualStudioSymbolSearchLogService((IVsActivityLog)serviceProvider.GetService(typeof(SVsActivityLog)));
_logService = new LogService((IVsActivityLog)serviceProvider.GetService(typeof(SVsActivityLog)));
}
protected override void EnableService()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册