Skip to content

Commit

Permalink
Support FAR in cohosting (#11238)
Browse files Browse the repository at this point in the history
Fixes #11237
Needs dotnet/roslyn#76002 and a version bump

Very simple one, though I was a little cheeky. There is basically no
code that could be shared, except for code that removes `__o` and
`k_BackingField` from the results, but those methods operate on VS LSP
types. Given cohosting largely uses Roslyn LSP types, and will be
exclusively FUSE, and FUSE doesn't have `__o`, I just skipped that bit.
Confirmed in VS that having cohosting and FUSE on makes for nice looking
results with no generated code artifacts.

Side note: I don't think anything will ever have `k_BackingField` in the
results, but there is zero test coverage so who knows! 😁
  • Loading branch information
davidwengier authored Dec 1, 2024
2 parents 5f32f26 + 973553f commit db3fecf
Show file tree
Hide file tree
Showing 9 changed files with 520 additions and 58 deletions.
76 changes: 38 additions & 38 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,82 +11,82 @@
<Sha>ef10a9fae360251bdd4b7552a4c90bf626977453</Sha>
<SourceBuild RepoName="source-build-reference-packages" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="4.13.0-2.24564.3">
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="4.13.0-3.24576.11">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
<Sha>6f2ed01d1af9429d874aca1eea60d3212167bc40</Sha>
</Dependency>
<Dependency Name="Microsoft.CommonLanguageServerProtocol.Framework" Version="4.13.0-2.24564.3">
<Dependency Name="Microsoft.CommonLanguageServerProtocol.Framework" Version="4.13.0-3.24576.11">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
<Sha>6f2ed01d1af9429d874aca1eea60d3212167bc40</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.ExternalAccess.Razor" Version="4.13.0-2.24564.3">
<Dependency Name="Microsoft.CodeAnalysis.ExternalAccess.Razor" Version="4.13.0-3.24576.11">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
<Sha>6f2ed01d1af9429d874aca1eea60d3212167bc40</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Common" Version="4.13.0-2.24564.3">
<Dependency Name="Microsoft.CodeAnalysis.Common" Version="4.13.0-3.24576.11">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
<Sha>6f2ed01d1af9429d874aca1eea60d3212167bc40</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.CSharp" Version="4.13.0-2.24564.3">
<Dependency Name="Microsoft.CodeAnalysis.CSharp" Version="4.13.0-3.24576.11">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
<Sha>6f2ed01d1af9429d874aca1eea60d3212167bc40</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.CSharp.EditorFeatures" Version="4.13.0-2.24564.3">
<Dependency Name="Microsoft.CodeAnalysis.CSharp.EditorFeatures" Version="4.13.0-3.24576.11">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
<Sha>6f2ed01d1af9429d874aca1eea60d3212167bc40</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.CSharp.Features" Version="4.13.0-2.24564.3">
<Dependency Name="Microsoft.CodeAnalysis.CSharp.Features" Version="4.13.0-3.24576.11">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
<Sha>6f2ed01d1af9429d874aca1eea60d3212167bc40</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.13.0-2.24564.3">
<Dependency Name="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.13.0-3.24576.11">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
<Sha>6f2ed01d1af9429d874aca1eea60d3212167bc40</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures" Version="4.13.0-2.24564.3">
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures" Version="4.13.0-3.24576.11">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
<Sha>6f2ed01d1af9429d874aca1eea60d3212167bc40</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures.Common" Version="4.13.0-2.24564.3">
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures.Common" Version="4.13.0-3.24576.11">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
<Sha>6f2ed01d1af9429d874aca1eea60d3212167bc40</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures.Text" Version="4.13.0-2.24564.3">
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures.Text" Version="4.13.0-3.24576.11">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
<Sha>6f2ed01d1af9429d874aca1eea60d3212167bc40</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures.Wpf" Version="4.13.0-2.24564.3">
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures.Wpf" Version="4.13.0-3.24576.11">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
<Sha>6f2ed01d1af9429d874aca1eea60d3212167bc40</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Remote.ServiceHub" Version="4.13.0-2.24564.3">
<Dependency Name="Microsoft.CodeAnalysis.Remote.ServiceHub" Version="4.13.0-3.24576.11">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
<Sha>6f2ed01d1af9429d874aca1eea60d3212167bc40</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="4.13.0-2.24564.3">
<Dependency Name="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="4.13.0-3.24576.11">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
<Sha>6f2ed01d1af9429d874aca1eea60d3212167bc40</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.13.0-2.24564.3">
<Dependency Name="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.13.0-3.24576.11">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
<Sha>6f2ed01d1af9429d874aca1eea60d3212167bc40</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.13.0-2.24564.3">
<Dependency Name="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.13.0-3.24576.11">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
<Sha>6f2ed01d1af9429d874aca1eea60d3212167bc40</Sha>
</Dependency>
<Dependency Name="Microsoft.VisualStudio.LanguageServices" Version="4.13.0-2.24564.3">
<Dependency Name="Microsoft.VisualStudio.LanguageServices" Version="4.13.0-3.24576.11">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
<Sha>6f2ed01d1af9429d874aca1eea60d3212167bc40</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Test.Utilities" Version="4.13.0-2.24564.3">
<Dependency Name="Microsoft.CodeAnalysis.Test.Utilities" Version="4.13.0-3.24576.11">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
<Sha>6f2ed01d1af9429d874aca1eea60d3212167bc40</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.roslyn" Version="4.13.0-2.24564.3">
<Dependency Name="Microsoft.SourceBuild.Intermediate.roslyn" Version="4.13.0-3.24576.11">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>826b0db12582b6b645ed1cf5e1565f767af31e53</Sha>
<Sha>6f2ed01d1af9429d874aca1eea60d3212167bc40</Sha>
<SourceBuild RepoName="roslyn" ManagedOnly="true" />
</Dependency>
</ProductDependencies>
Expand Down
38 changes: 19 additions & 19 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,25 @@
<MicrosoftSourceBuildIntermediatearcadePackageVersion>9.0.0-beta.24572.2</MicrosoftSourceBuildIntermediatearcadePackageVersion>
<MicrosoftDotNetXliffTasksPackageVersion>1.0.0-beta.23475.1</MicrosoftDotNetXliffTasksPackageVersion>
<MicrosoftSourceBuildIntermediatexlifftasksPackageVersion>1.0.0-beta.23475.1</MicrosoftSourceBuildIntermediatexlifftasksPackageVersion>
<MicrosoftNetCompilersToolsetPackageVersion>4.13.0-2.24564.3</MicrosoftNetCompilersToolsetPackageVersion>
<MicrosoftCommonLanguageServerProtocolFrameworkPackageVersion>4.13.0-2.24564.3</MicrosoftCommonLanguageServerProtocolFrameworkPackageVersion>
<MicrosoftCodeAnalysisExternalAccessRazorPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisExternalAccessRazorPackageVersion>
<MicrosoftCodeAnalysisCommonPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisCommonPackageVersion>
<MicrosoftCodeAnalysisCSharpPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisCSharpPackageVersion>
<MicrosoftCodeAnalysisCSharpEditorFeaturesPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisCSharpEditorFeaturesPackageVersion>
<MicrosoftCodeAnalysisCSharpFeaturesPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisCSharpFeaturesPackageVersion>
<MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisEditorFeaturesPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesCommonPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisEditorFeaturesCommonPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesTextPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisEditorFeaturesTextPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesWpfPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisEditorFeaturesWpfPackageVersion>
<MicrosoftCodeAnalysisRemoteServiceHubPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisRemoteServiceHubPackageVersion>
<MicrosoftCodeAnalysisTestUtilitiesPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisTestUtilitiesPackageVersion>
<MicrosoftCodeAnalysisVisualBasicWorkspacesPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisVisualBasicWorkspacesPackageVersion>
<MicrosoftCodeAnalysisWorkspacesCommonPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisWorkspacesCommonPackageVersion>
<MicrosoftCodeAnalysisWorkspacesMSBuildPackageVersion>4.13.0-2.24564.3</MicrosoftCodeAnalysisWorkspacesMSBuildPackageVersion>
<MicrosoftSourceBuildIntermediateroslynPackageVersion>4.13.0-2.24564.3</MicrosoftSourceBuildIntermediateroslynPackageVersion>
<MicrosoftVisualStudioLanguageServicesPackageVersion>4.13.0-2.24564.3</MicrosoftVisualStudioLanguageServicesPackageVersion>
<MicrosoftNetCompilersToolsetPackageVersion>4.13.0-3.24576.11</MicrosoftNetCompilersToolsetPackageVersion>
<MicrosoftCommonLanguageServerProtocolFrameworkPackageVersion>4.13.0-3.24576.11</MicrosoftCommonLanguageServerProtocolFrameworkPackageVersion>
<MicrosoftCodeAnalysisExternalAccessRazorPackageVersion>4.13.0-3.24576.11</MicrosoftCodeAnalysisExternalAccessRazorPackageVersion>
<MicrosoftCodeAnalysisCommonPackageVersion>4.13.0-3.24576.11</MicrosoftCodeAnalysisCommonPackageVersion>
<MicrosoftCodeAnalysisCSharpPackageVersion>4.13.0-3.24576.11</MicrosoftCodeAnalysisCSharpPackageVersion>
<MicrosoftCodeAnalysisCSharpEditorFeaturesPackageVersion>4.13.0-3.24576.11</MicrosoftCodeAnalysisCSharpEditorFeaturesPackageVersion>
<MicrosoftCodeAnalysisCSharpFeaturesPackageVersion>4.13.0-3.24576.11</MicrosoftCodeAnalysisCSharpFeaturesPackageVersion>
<MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>4.13.0-3.24576.11</MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesPackageVersion>4.13.0-3.24576.11</MicrosoftCodeAnalysisEditorFeaturesPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesCommonPackageVersion>4.13.0-3.24576.11</MicrosoftCodeAnalysisEditorFeaturesCommonPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesTextPackageVersion>4.13.0-3.24576.11</MicrosoftCodeAnalysisEditorFeaturesTextPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesWpfPackageVersion>4.13.0-3.24576.11</MicrosoftCodeAnalysisEditorFeaturesWpfPackageVersion>
<MicrosoftCodeAnalysisRemoteServiceHubPackageVersion>4.13.0-3.24576.11</MicrosoftCodeAnalysisRemoteServiceHubPackageVersion>
<MicrosoftCodeAnalysisTestUtilitiesPackageVersion>4.13.0-3.24576.11</MicrosoftCodeAnalysisTestUtilitiesPackageVersion>
<MicrosoftCodeAnalysisVisualBasicWorkspacesPackageVersion>4.13.0-3.24576.11</MicrosoftCodeAnalysisVisualBasicWorkspacesPackageVersion>
<MicrosoftCodeAnalysisWorkspacesCommonPackageVersion>4.13.0-3.24576.11</MicrosoftCodeAnalysisWorkspacesCommonPackageVersion>
<MicrosoftCodeAnalysisWorkspacesMSBuildPackageVersion>4.13.0-3.24576.11</MicrosoftCodeAnalysisWorkspacesMSBuildPackageVersion>
<MicrosoftSourceBuildIntermediateroslynPackageVersion>4.13.0-3.24576.11</MicrosoftSourceBuildIntermediateroslynPackageVersion>
<MicrosoftVisualStudioLanguageServicesPackageVersion>4.13.0-3.24576.11</MicrosoftVisualStudioLanguageServicesPackageVersion>
<!--
Exception - Microsoft.Extensions.ObjectPool and System.Collections.Immutable packages are not updated by automation,
but are present in Version.Details.xml for source-build PVP flow. See the comment in Version.Details.xml for more information.
Expand Down
1 change: 1 addition & 0 deletions eng/targets/Services.props
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@
<ServiceHubService Include="Microsoft.VisualStudio.Razor.Hover" ClassName="Microsoft.CodeAnalysis.Remote.Razor.RemoteHoverService+Factory" />
<ServiceHubService Include="Microsoft.VisualStudio.Razor.Completion" ClassName="Microsoft.CodeAnalysis.Remote.Razor.RemoteCompletionService+Factory" />
<ServiceHubService Include="Microsoft.VisualStudio.Razor.CodeActions" ClassName="Microsoft.CodeAnalysis.Remote.Razor.RemoteCodeActionsService+Factory" />
<ServiceHubService Include="Microsoft.VisualStudio.Razor.FindAllReferences" ClassName="Microsoft.CodeAnalysis.Remote.Razor.RemoteFindAllReferencesService+Factory" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,15 @@ static void AddHandlers(IServiceCollection services, LanguageServerFeatureOption
services.AddHandler<ColorPresentationEndpoint>();

services.AddHandlerWithCapabilities<ProjectContextsEndpoint>();

services.AddHandlerWithCapabilities<FindAllReferencesEndpoint>();
}

services.AddHandler<WrapWithTagEndpoint>();
services.AddHandler<RazorBreakpointSpanEndpoint>();
services.AddHandler<RazorProximityExpressionsEndpoint>();

services.AddHandlerWithCapabilities<ValidateBreakpointRangeEndpoint>();
services.AddHandlerWithCapabilities<FindAllReferencesEndpoint>();
services.AddHandlerWithCapabilities<MapCodeEndpoint>();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// 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.ExternalAccess.Razor;
using Roslyn.LanguageServer.Protocol;
using LspLocation = Roslyn.LanguageServer.Protocol.Location;

namespace Microsoft.CodeAnalysis.Razor.Remote;

internal interface IRemoteFindAllReferencesService : IRemoteJsonService
{
ValueTask<RemoteResponse<SumType<VSInternalReferenceItem, LspLocation>[]?>> FindAllReferencesAsync(
JsonSerializableRazorPinnedSolutionInfoWrapper solutionInfo,
JsonSerializableDocumentId razorDocumentId,
Position position,
CancellationToken cancellationToken);
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ internal static class RazorServices
(typeof(IRemoteDiagnosticsService), null),
(typeof(IRemoteCompletionService), null),
(typeof(IRemoteCodeActionsService), null),
(typeof(IRemoteFindAllReferencesService), null),
];

private const string ComponentName = "Razor";
Expand Down
Loading

0 comments on commit db3fecf

Please sign in to comment.