This commit is contained in:
Ryan Brandenburg 2022-09-20 14:38:15 -07:00
Родитель e543be6607
Коммит d29901df24
6 изменённых файлов: 13 добавлений и 35 удалений

Просмотреть файл

@ -22,6 +22,7 @@
<add key="richnav" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-buildservices/nuget/v3/index.json" />
<!-- Used for BenchmarkDotNet prerelease packages -->
<add key="benchmark-dotnet-prerelease" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/benchmark-dotnet-prerelease/nuget/v3/index.json" />
<add key="general-testing" value="https://dnceng.pkgs.visualstudio.com/public/_packaging/general-testing/nuget/v3/index.json" />
</packageSources>
<!--
****************************** AUTOGENERATED ***********************************
@ -40,6 +41,9 @@
-->
<packageSourceMapping>
<clear />
<packageSource key="general-testing">
<package pattern="microsoft.commonlanguageserverProtocol.*" />
</packageSource>
<packageSource key="dotnet-core-internal-tooling">
<package pattern="microsoft.*" />
</packageSource>

Просмотреть файл

@ -79,6 +79,7 @@
<RoslynPackageVersion>4.4.0-2.22424.2</RoslynPackageVersion>
<VisualStudioLanguageServerProtocolVersion>17.4.1004-preview</VisualStudioLanguageServerProtocolVersion>
<MicrosoftNetCompilersToolsetVersion>4.4.0-1.final</MicrosoftNetCompilersToolsetVersion>
<MicrosoftCommonLanguageServerProtocolFrameworkPackageVersion>4.4.0-3.22463.10</MicrosoftCommonLanguageServerProtocolFrameworkPackageVersion>
</PropertyGroup>
<PropertyGroup Label="Manual">
<!-- dotnet/runtime packages -->

Просмотреть файл

@ -9,7 +9,6 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using Microsoft.AspNetCore.Razor.LanguageServer;
using Microsoft.AspNetCore.Razor.LanguageServer.Extensions;
using Microsoft.AspNetCore.Razor.LanguageServer.Formatting;
using Microsoft.CodeAnalysis.Razor.ProjectSystem;
@ -30,8 +29,6 @@ namespace Microsoft.AspNetCore.Razor.Microbenchmarks.LanguageServer
{
private string _filePath;
private RazorLanguageServerWrapper RazorLanguageServer { get; set; }
private RazorFormattingService RazorFormattingService { get; set; }
private Uri DocumentUri { get; set; }
@ -52,7 +49,7 @@ namespace Microsoft.AspNetCore.Razor.Microbenchmarks.LanguageServer
[GlobalSetup(Target = nameof(RazorCSharpFormattingAsync))]
public async Task InitializeRazorCSharpFormattingAsync()
{
await EnsureServicesInitializedAsync();
EnsureServicesInitialized();
var projectRoot = Path.Combine(RepoRoot, "src", "Razor", "test", "testapps", "ComponentApp");
var projectFilePath = Path.Combine(projectRoot, "ComponentApp.csproj");
@ -137,15 +134,8 @@ namespace Microsoft.AspNetCore.Razor.Microbenchmarks.LanguageServer
await RazorLanguageServer.DisposeAsync();
}
private async Task EnsureServicesInitializedAsync()
private void EnsureServicesInitialized()
{
if (RazorLanguageServerTask != null)
{
return;
}
RazorLanguageServer = await RazorLanguageServerTask;
var languageServer = RazorLanguageServer.GetInnerLanguageServerForTesting();
RazorFormattingService = languageServer.GetRequiredService<RazorFormattingService>();
}

Просмотреть файл

@ -30,7 +30,7 @@ namespace Microsoft.AspNetCore.Razor.Microbenchmarks.LanguageServer
RepoRoot = current.FullName;
using var memoryStream = new MemoryStream();
RazorLanguageServerTask = RazorLanguageServerWrapper.CreateAsync(memoryStream, memoryStream, Trace.Off, configure: (collection) => {
RazorLanguageServer = RazorLanguageServerWrapper.Create(memoryStream, memoryStream, Trace.Off, configure: (collection) => {
collection.AddSingleton<ClientNotifierServiceBase, NoopClientNotifierService>();
Builder(collection);
});
@ -42,7 +42,7 @@ namespace Microsoft.AspNetCore.Razor.Microbenchmarks.LanguageServer
protected string RepoRoot { get; }
private protected Task<RazorLanguageServerWrapper> RazorLanguageServerTask { get; }
private protected RazorLanguageServerWrapper RazorLanguageServer { get; }
internal DocumentSnapshot GetDocumentSnapshot(string projectFilePath, string filePath, string targetPath)
{

Просмотреть файл

@ -22,8 +22,6 @@ namespace Microsoft.AspNetCore.Razor.Microbenchmarks.LanguageServer
{
public class RazorSemanticTokensBenchmark : RazorLanguageServerBenchmarkBase
{
private RazorLanguageServerWrapper RazorLanguageServer { get; set; }
private DefaultRazorSemanticTokensInfoService RazorSemanticTokenService { get; set; }
private DocumentVersionCache VersionCache { get; set; }
@ -47,7 +45,7 @@ namespace Microsoft.AspNetCore.Razor.Microbenchmarks.LanguageServer
[GlobalSetup(Target = nameof(RazorSemanticTokensRangeAsync))]
public async Task InitializeRazorSemanticAsync()
{
await EnsureServicesInitializedAsync();
EnsureServicesInitialized();
var projectRoot = Path.Combine(RepoRoot, "src", "Razor", "test", "testapps", "ComponentApp");
ProjectFilePath = Path.Combine(projectRoot, "ComponentApp.csproj");
@ -113,15 +111,8 @@ namespace Microsoft.AspNetCore.Razor.Microbenchmarks.LanguageServer
collection.AddSingleton<RazorSemanticTokensInfoService, TestRazorSemanticTokensInfoService>();
}
private async Task EnsureServicesInitializedAsync()
private void EnsureServicesInitialized()
{
if (RazorLanguageServerTask != null)
{
return;
}
RazorLanguageServer = await RazorLanguageServerTask;
var languageServer = RazorLanguageServer.GetInnerLanguageServerForTesting();
RazorSemanticTokenService = languageServer.GetRequiredService<RazorSemanticTokensInfoService>() as TestRazorSemanticTokensInfoService;
VersionCache = languageServer.GetRequiredService<DocumentVersionCache>();

Просмотреть файл

@ -20,8 +20,6 @@ namespace Microsoft.AspNetCore.Razor.Microbenchmarks.LanguageServer
{
public class RazorSemanticTokensScrollingBenchmark : RazorLanguageServerBenchmarkBase
{
private RazorLanguageServerWrapper RazorLanguageServer { get; set; }
private DefaultRazorSemanticTokensInfoService RazorSemanticTokenService { get; set; }
private DocumentVersionCache VersionCache { get; set; }
@ -45,7 +43,7 @@ namespace Microsoft.AspNetCore.Razor.Microbenchmarks.LanguageServer
[GlobalSetup(Target = nameof(RazorSemanticTokensRangeScrollingAsync))]
public async Task InitializeRazorSemanticAsync()
{
await EnsureServicesInitializedAsync();
EnsureServicesInitialized();
var projectRoot = Path.Combine(RepoRoot, "src", "Razor", "test", "testapps", "ComponentApp");
ProjectFilePath = Path.Combine(projectRoot, "ComponentApp.csproj");
@ -125,14 +123,8 @@ namespace Microsoft.AspNetCore.Razor.Microbenchmarks.LanguageServer
collection.AddSingleton<RazorSemanticTokensInfoService, TestRazorSemanticTokensInfoService>();
}
private async Task EnsureServicesInitializedAsync()
private void EnsureServicesInitialized()
{
if (RazorLanguageServer != null)
{
return;
}
RazorLanguageServer = await RazorLanguageServerTask.ConfigureAwait(false);
var languageServer = RazorLanguageServer.GetInnerLanguageServerForTesting();
RazorSemanticTokenService = (languageServer.GetRequiredService<RazorSemanticTokensInfoService>() as TestRazorSemanticTokensInfoService)!;
VersionCache = languageServer.GetRequiredService<DocumentVersionCache>();