-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix find all references calls to Roslyn (#10807)
Fixes integration test failures in Find All References. Roslyns LSP types got much more spec compliant in dotnet/roslyn#73911 and we were never sending the `Context` property in our request, so deserialization failed on their end.
- Loading branch information
Showing
2 changed files
with
48 additions
and
4 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
...uageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_FindAllReferences.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the MIT license. See License.txt in the project root for license information. | ||
|
||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Microsoft.CodeAnalysis.Razor.Protocol; | ||
using Microsoft.VisualStudio.LanguageServer.Protocol; | ||
using StreamJsonRpc; | ||
|
||
namespace Microsoft.VisualStudio.Razor.LanguageClient.Endpoints; | ||
|
||
internal partial class RazorCustomMessageTarget | ||
{ | ||
[JsonRpcMethod(CustomMessageNames.RazorReferencesEndpointName, UseSingleObjectParameterDeserialization = true)] | ||
public async Task<VSInternalReferenceItem[]?> ReferencesAsync(DelegatedPositionParams request, CancellationToken cancellationToken) | ||
{ | ||
var delegationDetails = await GetProjectedRequestDetailsAsync(request, cancellationToken).ConfigureAwait(false); | ||
if (delegationDetails is null) | ||
{ | ||
return default; | ||
} | ||
|
||
var referenceParams = new ReferenceParams() | ||
{ | ||
TextDocument = new VSTextDocumentIdentifier() | ||
{ | ||
Uri = delegationDetails.Value.ProjectedUri, | ||
ProjectContext = null, | ||
}, | ||
Position = request.ProjectedPosition, | ||
Context = new ReferenceContext(), | ||
}; | ||
|
||
var response = await _requestInvoker.ReinvokeRequestOnServerAsync<ReferenceParams, VSInternalReferenceItem[]?>( | ||
delegationDetails.Value.TextBuffer, | ||
Methods.TextDocumentReferencesName, | ||
delegationDetails.Value.LanguageServerName, | ||
referenceParams, | ||
cancellationToken).ConfigureAwait(false); | ||
|
||
if (response is null) | ||
{ | ||
return default; | ||
} | ||
|
||
return response.Response; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters