Skip to content

Commit

Permalink
Provide required callback targets
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell committed Sep 28, 2020
1 parent de348c5 commit e0e3655
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static async Task<ImmutableArray<ISymbol>> FindAllDeclarationsWithNormalQ
var result = await client.TryInvokeAsync<IRemoteSymbolFinderService, ImmutableArray<SerializableSymbolAndProjectId>>(
solution,
(service, solutionInfo, cancellationToken) => service.FindAllDeclarationsWithNormalQueryAsync(solutionInfo, project.Id, query.Name, query.Kind, criteria, cancellationToken),
callbackTarget: null,
callbackTarget: SymbolFinder.EmptyServerCallback.Instance,
cancellationToken).ConfigureAwait(false);

if (!result.HasValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static async Task<ImmutableArray<ISymbol>> FindSourceDeclarationsWithNorm
var result = await client.TryInvokeAsync<IRemoteSymbolFinderService, ImmutableArray<SerializableSymbolAndProjectId>>(
solution,
(service, solutionInfo, cancellationToken) => service.FindSolutionSourceDeclarationsWithNormalQueryAsync(solutionInfo, name, ignoreCase, criteria, cancellationToken),
callbackTarget: null,
callbackTarget: SymbolFinder.EmptyServerCallback.Instance,
cancellationToken).ConfigureAwait(false);

if (!result.HasValue)
Expand Down Expand Up @@ -86,7 +86,7 @@ public static async Task<ImmutableArray<ISymbol>> FindSourceDeclarationsWithNorm
var result = await client.TryInvokeAsync<IRemoteSymbolFinderService, ImmutableArray<SerializableSymbolAndProjectId>>(
project.Solution,
(service, solutionInfo, cancellationToken) => service.FindProjectSourceDeclarationsWithNormalQueryAsync(solutionInfo, project.Id, name, ignoreCase, criteria, cancellationToken),
callbackTarget: null,
callbackTarget: SymbolFinder.EmptyServerCallback.Instance,
cancellationToken).ConfigureAwait(false);

if (!result.HasValue)
Expand Down Expand Up @@ -120,7 +120,7 @@ public static async Task<ImmutableArray<ISymbol>> FindSourceDeclarationsWithPatt
var result = await client.TryInvokeAsync<IRemoteSymbolFinderService, ImmutableArray<SerializableSymbolAndProjectId>>(
solution,
(service, solutionInfo, cancellationToken) => service.FindSolutionSourceDeclarationsWithPatternAsync(solutionInfo, pattern, criteria, cancellationToken),
callbackTarget: null,
callbackTarget: SymbolFinder.EmptyServerCallback.Instance,
cancellationToken).ConfigureAwait(false);

if (!result.HasValue)
Expand Down Expand Up @@ -154,7 +154,7 @@ public static async Task<ImmutableArray<ISymbol>> FindSourceDeclarationsWithPatt
var result = await client.TryInvokeAsync<IRemoteSymbolFinderService, ImmutableArray<SerializableSymbolAndProjectId>>(
project.Solution,
(service, solutionInfo, cancellationToken) => service.FindProjectSourceDeclarationsWithPatternAsync(solutionInfo, project.Id, pattern, criteria, cancellationToken),
callbackTarget: null,
callbackTarget: SymbolFinder.EmptyServerCallback.Instance,
cancellationToken).ConfigureAwait(false);

if (!result.HasValue)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Remote;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.FindSymbols
{
public static partial class SymbolFinder
{
internal sealed class EmptyServerCallback : IRemoteSymbolFinderService.ICallback
{
public static readonly EmptyServerCallback Instance = new();

private EmptyServerCallback()
{
}

public ValueTask AddItemsAsync(int count)
=> throw ExceptionUtilities.Unreachable;

public ValueTask ItemCompletedAsync()
=> throw ExceptionUtilities.Unreachable;

public ValueTask OnLiteralReferenceFoundAsync(DocumentId documentId, TextSpan span)
=> throw ExceptionUtilities.Unreachable;

public ValueTask OnCompletedAsync()
=> throw ExceptionUtilities.Unreachable;

public ValueTask OnDefinitionFoundAsync(SerializableSymbolAndProjectId definition)
=> throw ExceptionUtilities.Unreachable;

public ValueTask OnFindInDocumentCompletedAsync(DocumentId documentId)
=> throw ExceptionUtilities.Unreachable;

public ValueTask OnFindInDocumentStartedAsync(DocumentId documentId)
=> throw ExceptionUtilities.Unreachable;

public ValueTask OnReferenceFoundAsync(SerializableSymbolAndProjectId definition, SerializableReferenceLocation reference)
=> throw ExceptionUtilities.Unreachable;

public ValueTask OnStartedAsync()
=> throw ExceptionUtilities.Unreachable;
}
}
}

0 comments on commit e0e3655

Please sign in to comment.