提交 fffa7915 编写于 作者: H Heejae Chang 提交者: GitHub

Merge pull request #18037 from heejaechang/codelenclean

remove CodeLensArguement
......@@ -36,7 +36,7 @@ internal sealed class RemoteCodeLensReferencesService : ICodeLensReferencesServi
// TODO: send telemetry on session
return await remoteHostClient.RunCodeAnalysisServiceOnRemoteHostAsync<ReferenceCount>(
solution, WellKnownServiceHubServices.CodeAnalysisService_GetReferenceCountAsync,
new object[] { new CodeLensArguments(documentId, syntaxNode), maxSearchResults }, cancellationToken).ConfigureAwait(false);
new object[] { documentId, syntaxNode.Span, maxSearchResults }, cancellationToken).ConfigureAwait(false);
}
}
......@@ -60,7 +60,7 @@ internal sealed class RemoteCodeLensReferencesService : ICodeLensReferencesServi
// TODO: send telemetry on session
return await remoteHostClient.RunCodeAnalysisServiceOnRemoteHostAsync<IEnumerable<ReferenceLocationDescriptor>>(
solution, WellKnownServiceHubServices.CodeAnalysisService_FindReferenceLocationsAsync,
new CodeLensArguments(documentId, syntaxNode), cancellationToken).ConfigureAwait(false);
new object[] { documentId, syntaxNode.Span }, cancellationToken).ConfigureAwait(false);
}
}
......@@ -84,7 +84,7 @@ internal sealed class RemoteCodeLensReferencesService : ICodeLensReferencesServi
// TODO: send telemetry on session
return await remoteHostClient.RunCodeAnalysisServiceOnRemoteHostAsync<IEnumerable<ReferenceMethodDescriptor>>(
solution, WellKnownServiceHubServices.CodeAnalysisService_FindReferenceMethodsAsync,
new CodeLensArguments(documentId, syntaxNode), cancellationToken).ConfigureAwait(false);
new object[] { documentId, syntaxNode.Span }, cancellationToken).ConfigureAwait(false);
}
}
......@@ -108,7 +108,7 @@ internal sealed class RemoteCodeLensReferencesService : ICodeLensReferencesServi
// TODO: send telemetry on session
return await remoteHostClient.RunCodeAnalysisServiceOnRemoteHostAsync<string>(
solution, WellKnownServiceHubServices.CodeAnalysisService_GetFullyQualifiedName,
new CodeLensArguments(documentId, syntaxNode), cancellationToken).ConfigureAwait(false);
new object[] { documentId, syntaxNode.Span }, cancellationToken).ConfigureAwait(false);
}
}
}
......
......@@ -67,9 +67,6 @@
<PublicAPI Include="PublicAPI.Unshipped.txt" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\Workspaces\Remote\ServiceHub\CodeLens\CodeLensArguments.cs">
<Link>CodeLens\CodeLensArguments.cs</Link>
</Compile>
<Compile Include="..\..\..\Workspaces\Remote\ServiceHub\Shared\ClientDirectStream.cs">
<Link>Shared\ClientDirectStream.cs</Link>
</Compile>
......
// 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;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis.Execution;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.Remote.Diagnostics
{
/// <summary>
/// helper type to package diagnostic arguments to pass around between remote hosts
/// </summary>
internal class CodeLensArguments
{
public Guid ProjectIdGuid;
public string ProjectIdDebugName;
public Guid DocumentIdGuid;
public string DocumentIdDebugName;
public int Start;
public int Length;
public CodeLensArguments()
{
}
public CodeLensArguments(DocumentId documentId, SyntaxNode syntaxNode)
{
ProjectIdGuid = documentId.ProjectId.Id;
ProjectIdDebugName = documentId.ProjectId.DebugName;
DocumentIdGuid = documentId.Id;
DocumentIdDebugName = documentId.DebugName;
Start = syntaxNode.Span.Start;
Length = syntaxNode.Span.Length;
}
public DocumentId GetDocumentId()
=>
DocumentId.CreateFromSerialized(ProjectId.CreateFromSerialized(ProjectIdGuid, ProjectIdDebugName),
DocumentIdGuid, DocumentIdDebugName);
public TextSpan GetTextSpan() => new TextSpan(Start, Length);
}
}
\ No newline at end of file
......@@ -60,7 +60,6 @@
<Compile Include="..\..\..\VisualStudio\Core\Def\Telemetry\VSTelemetryLogger.cs">
<Link>Telemetry\VSTelemetryLogger.cs</Link>
</Compile>
<Compile Include="CodeLens\CodeLensArguments.cs" />
<Compile Include="Services\CodeAnalysisService_CodeLens.cs" />
<Compile Include="Services\CodeAnalysisService_DesignerAttributes.cs" />
<Compile Include="Services\CodeAnalysisService_TodoComments.cs" />
......
......@@ -7,18 +7,16 @@
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.Remote.Diagnostics;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.Remote
{
internal partial class CodeAnalysisService
{
public async Task<ReferenceCount> GetReferenceCountAsync(CodeLensArguments arguments, int maxResultCount)
public async Task<ReferenceCount> GetReferenceCountAsync(DocumentId documentId, TextSpan textSpan, int maxResultCount)
{
try
{
var documentId = arguments.GetDocumentId();
var textSpan = arguments.GetTextSpan();
using (Internal.Log.Logger.LogBlock(FunctionId.CodeAnalysisService_GetReferenceCountAsync, documentId.ProjectId.DebugName, CancellationToken))
{
var solution = await GetSolutionAsync().ConfigureAwait(false);
......@@ -43,13 +41,10 @@ public async Task<ReferenceCount> GetReferenceCountAsync(CodeLensArguments argum
return null;
}
public async Task<IEnumerable<ReferenceLocationDescriptor>> FindReferenceLocationsAsync(CodeLensArguments arguments)
public async Task<IEnumerable<ReferenceLocationDescriptor>> FindReferenceLocationsAsync(DocumentId documentId, TextSpan textSpan)
{
try
{
var documentId = arguments.GetDocumentId();
var textSpan = arguments.GetTextSpan();
using (Internal.Log.Logger.LogBlock(FunctionId.CodeAnalysisService_FindReferenceLocationsAsync, documentId.ProjectId.DebugName, CancellationToken))
{
var solution = await GetSolutionAsync().ConfigureAwait(false);
......@@ -74,13 +69,10 @@ public async Task<IEnumerable<ReferenceLocationDescriptor>> FindReferenceLocatio
return null;
}
public async Task<IEnumerable<ReferenceMethodDescriptor>> FindReferenceMethodsAsync(CodeLensArguments arguments)
public async Task<IEnumerable<ReferenceMethodDescriptor>> FindReferenceMethodsAsync(DocumentId documentId, TextSpan textSpan)
{
try
{
var documentId = arguments.GetDocumentId();
var textSpan = arguments.GetTextSpan();
using (Internal.Log.Logger.LogBlock(FunctionId.CodeAnalysisService_FindReferenceMethodsAsync, documentId.ProjectId.DebugName, CancellationToken))
{
var solution = await GetSolutionAsync().ConfigureAwait(false);
......@@ -105,13 +97,10 @@ public async Task<IEnumerable<ReferenceMethodDescriptor>> FindReferenceMethodsAs
return null;
}
public async Task<string> GetFullyQualifiedName(CodeLensArguments arguments)
public async Task<string> GetFullyQualifiedName(DocumentId documentId, TextSpan textSpan)
{
try
{
var documentId = arguments.GetDocumentId();
var textSpan = arguments.GetTextSpan();
using (Internal.Log.Logger.LogBlock(FunctionId.CodeAnalysisService_GetFullyQualifiedName, documentId.ProjectId.DebugName, CancellationToken))
{
var solution = await GetSolutionAsync().ConfigureAwait(false);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册