Skip to content

Commit e0e3655

Browse files
committed
Provide required callback targets
1 parent de348c5 commit e0e3655

File tree

3 files changed

+55
-5
lines changed

3 files changed

+55
-5
lines changed

src/Workspaces/Core/Portable/FindSymbols/Declarations/DeclarationFinder_AllDeclarations.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static async Task<ImmutableArray<ISymbol>> FindAllDeclarationsWithNormalQ
4444
var result = await client.TryInvokeAsync<IRemoteSymbolFinderService, ImmutableArray<SerializableSymbolAndProjectId>>(
4545
solution,
4646
(service, solutionInfo, cancellationToken) => service.FindAllDeclarationsWithNormalQueryAsync(solutionInfo, project.Id, query.Name, query.Kind, criteria, cancellationToken),
47-
callbackTarget: null,
47+
callbackTarget: SymbolFinder.EmptyServerCallback.Instance,
4848
cancellationToken).ConfigureAwait(false);
4949

5050
if (!result.HasValue)

src/Workspaces/Core/Portable/FindSymbols/Declarations/DeclarationFinder_SourceDeclarations.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public static async Task<ImmutableArray<ISymbol>> FindSourceDeclarationsWithNorm
4747
var result = await client.TryInvokeAsync<IRemoteSymbolFinderService, ImmutableArray<SerializableSymbolAndProjectId>>(
4848
solution,
4949
(service, solutionInfo, cancellationToken) => service.FindSolutionSourceDeclarationsWithNormalQueryAsync(solutionInfo, name, ignoreCase, criteria, cancellationToken),
50-
callbackTarget: null,
50+
callbackTarget: SymbolFinder.EmptyServerCallback.Instance,
5151
cancellationToken).ConfigureAwait(false);
5252

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

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

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

160160
if (!result.HasValue)
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System.Threading.Tasks;
6+
using Microsoft.CodeAnalysis.Remote;
7+
using Microsoft.CodeAnalysis.Text;
8+
using Roslyn.Utilities;
9+
10+
namespace Microsoft.CodeAnalysis.FindSymbols
11+
{
12+
public static partial class SymbolFinder
13+
{
14+
internal sealed class EmptyServerCallback : IRemoteSymbolFinderService.ICallback
15+
{
16+
public static readonly EmptyServerCallback Instance = new();
17+
18+
private EmptyServerCallback()
19+
{
20+
}
21+
22+
public ValueTask AddItemsAsync(int count)
23+
=> throw ExceptionUtilities.Unreachable;
24+
25+
public ValueTask ItemCompletedAsync()
26+
=> throw ExceptionUtilities.Unreachable;
27+
28+
public ValueTask OnLiteralReferenceFoundAsync(DocumentId documentId, TextSpan span)
29+
=> throw ExceptionUtilities.Unreachable;
30+
31+
public ValueTask OnCompletedAsync()
32+
=> throw ExceptionUtilities.Unreachable;
33+
34+
public ValueTask OnDefinitionFoundAsync(SerializableSymbolAndProjectId definition)
35+
=> throw ExceptionUtilities.Unreachable;
36+
37+
public ValueTask OnFindInDocumentCompletedAsync(DocumentId documentId)
38+
=> throw ExceptionUtilities.Unreachable;
39+
40+
public ValueTask OnFindInDocumentStartedAsync(DocumentId documentId)
41+
=> throw ExceptionUtilities.Unreachable;
42+
43+
public ValueTask OnReferenceFoundAsync(SerializableSymbolAndProjectId definition, SerializableReferenceLocation reference)
44+
=> throw ExceptionUtilities.Unreachable;
45+
46+
public ValueTask OnStartedAsync()
47+
=> throw ExceptionUtilities.Unreachable;
48+
}
49+
}
50+
}

0 commit comments

Comments
 (0)