Skip to content

Commit 7561e17

Browse files
authored
Allow more of Razor to use Roslyn Lsp types (#74597)
Once Web Tools has moved to System.Text.Json, we on Razor can move off of Visual Studio Lsp types, which resolves a licensing mismatch in the C# extension. To do this, we just need a bit more access to the Roslyn Lsp types. There was a couple of things missing, presumably added after forking, so I went ahead and added them, but only the minimum that Razor actually needs. Mikayla's PR probably already covers these too, and more obviously.
2 parents 80ccf3f + 6781b3e commit 7561e17

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

src/LanguageServer/Protocol/Handler/Diagnostics/PullDiagnosticCategories.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ internal static class PullDiagnosticCategories
1616
/// <summary>
1717
/// Edit and Continue diagnostics. Can be for Document or Workspace pull requests.
1818
/// </summary>
19-
public static readonly string EditAndContinue = VSInternalDiagnosticKind.EditAndContiue.Value;
19+
public static readonly string EditAndContinue = VSInternalDiagnosticKind.EditAndContinue.Value;
2020

2121
// Workspace categories
2222

src/LanguageServer/Protocol/Microsoft.CodeAnalysis.LanguageServer.Protocol.csproj

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,22 @@
3737
<!-- Full IVT is through ExternalAccess for functionality -->
3838
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.ExternalAccess.Razor" />
3939
<!-- Restricted IVT is direct for protocol types only -->
40+
<RestrictedInternalsVisibleTo Include="Microsoft.AspNetCore.Razor.LanguageServer" Namespace="Roslyn.LanguageServer.Protocol" Partner="Razor" Key="$(RazorKey)" />
41+
<RestrictedInternalsVisibleTo Include="Microsoft.AspNetCore.Razor.LanguageServer" Namespace="Roslyn.Text.Adornments" Partner="Razor" Key="$(RazorKey)" />
4042
<RestrictedInternalsVisibleTo Include="Microsoft.CodeAnalysis.Razor.Workspaces" Namespace="Roslyn.LanguageServer.Protocol" Partner="Razor" Key="$(RazorKey)" />
43+
<RestrictedInternalsVisibleTo Include="Microsoft.CodeAnalysis.Razor.Workspaces" Namespace="Roslyn.Text.Adornments" Partner="Razor" Key="$(RazorKey)" />
4144
<RestrictedInternalsVisibleTo Include="Microsoft.CodeAnalysis.Remote.Razor" Namespace="Roslyn.LanguageServer.Protocol" Partner="Razor" Key="$(RazorKey)" />
45+
<RestrictedInternalsVisibleTo Include="Microsoft.CodeAnalysis.Remote.Razor" Namespace="Roslyn.Text.Adornments" Partner="Razor" Key="$(RazorKey)" />
4246
<RestrictedInternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.Razor" Namespace="Roslyn.LanguageServer.Protocol" Partner="Razor" Key="$(RazorKey)" />
43-
<!-- Restricted IVT for protocol types for Razor tests -->
47+
<RestrictedInternalsVisibleTo Include="rzls" Namespace="Roslyn.LanguageServer.Protocol" Partner="Razor" Key="$(RazorKey)" />
48+
<!-- Restricted IVT for protocol types for Razor tests and other non shipping code -->
49+
<RestrictedInternalsVisibleTo Include="Microsoft.AspNetCore.Razor.Microbenchmarks" Namespace="Roslyn.LanguageServer.Protocol" Partner="Razor" Key="$(RazorKey)" />
50+
<RestrictedInternalsVisibleTo Include="Microsoft.AspNetCore.Razor.LanguageServer.Test" Namespace="Roslyn.LanguageServer.Protocol" Partner="Razor" Key="$(RazorKey)" />
51+
<RestrictedInternalsVisibleTo Include="Microsoft.AspNetCore.Razor.LanguageServer.Test" Namespace="Roslyn.Text.Adornments" Partner="Razor" Key="$(RazorKey)" />
52+
<RestrictedInternalsVisibleTo Include="Microsoft.AspNetCore.Razor.Test.Common.Tooling" Namespace="Roslyn.LanguageServer.Protocol" Partner="Razor" Key="$(RazorKey)" />
53+
<RestrictedInternalsVisibleTo Include="Microsoft.VisualStudio.Razor.IntegrationTests" Namespace="Roslyn.Text.Adornments" Partner="Razor" Key="$(RazorKey)" />
54+
<RestrictedInternalsVisibleTo Include="Microsoft.CodeAnalysis.Razor.Workspaces.Test" Namespace="Roslyn.LanguageServer.Protocol" Partner="Razor" Key="$(RazorKey)" />
55+
<RestrictedInternalsVisibleTo Include="Microsoft.CodeAnalysis.Remote.Razor.Test" Namespace="Roslyn.LanguageServer.Protocol" Partner="Razor" Key="$(RazorKey)" />
4456
<RestrictedInternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.Razor.Test" Namespace="Roslyn.LanguageServer.Protocol" Partner="Razor" Key="$(RazorKey)" />
4557
<!-- Full IVT is through ExternalAccess for functionality -->
4658
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.ExternalAccess.Xaml" />
@@ -90,6 +102,7 @@
90102
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.Features.DiagnosticsTests.Utilities" />
91103
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.Features.Test.Utilities" />
92104
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.LanguageServer.Protocol.Test.Utilities" />
105+
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" Key="$(MoqPublicKey)" />
93106
</ItemGroup>
94107

95108
<ItemGroup>

src/LanguageServer/Protocol/Protocol/Internal/Diagnostics/VSInternalDiagnosticKind.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ internal readonly record struct VSInternalDiagnosticKind(string Value) : IString
2222
/// <summary>
2323
/// Edit and Continue diagnostic kind.
2424
/// </summary>
25-
public static readonly VSInternalDiagnosticKind EditAndContiue = new("enc");
25+
public static readonly VSInternalDiagnosticKind EditAndContinue = new("enc");
26+
27+
/// <summary>
28+
/// Syntax diagnostic kind.
29+
/// </summary>
30+
public static readonly VSInternalDiagnosticKind Syntax = new("syntax");
2631
}
2732
}

src/LanguageServer/Protocol/Protocol/Internal/VSInternalMapCodeParams.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,26 @@
44

55
namespace Roslyn.LanguageServer.Protocol
66
{
7+
using System;
78
using System.Text.Json.Serialization;
89

910
/// <summary>
1011
/// LSP Params for textDocument/mapCode calls.
1112
/// </summary>
1213
internal class VSInternalMapCodeParams
1314
{
15+
/// <summary>
16+
/// Internal correlation GUID, used to correlate map code messages from Copilot
17+
/// with LSP Client actions. Used for telemetry.
18+
/// </summary>
19+
[JsonPropertyName("_vs_map_code_correlation_id")]
20+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
21+
public Guid? MapCodeCorrelationId
22+
{
23+
get;
24+
set;
25+
}
26+
1427
/// <summary>
1528
/// Set of code blocks, associated with documents and regions, to map.
1629
/// </summary>

0 commit comments

Comments
 (0)