Skip to content

Commit 6a84cf5

Browse files
Rybrande/o#upgrade v2 (#2439)
O# upgrade
1 parent 6d240f8 commit 6a84cf5

File tree

128 files changed

+1048
-1046
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+1048
-1046
lines changed

eng/Signing.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
<ItemGroup>
1616
<FileSignInfo Include="Newtonsoft.Json.dll" CertificateName="3PartySHA2" />
1717
<FileSignInfo Include="MediatR.dll" CertificateName="3PartySHA2" />
18-
<FileSignInfo Include="MediatR.Extensions.Microsoft.DependencyInjection.dll" CertificateName="3PartySHA2" />
1918
<FileSignInfo Include="OmniSharp.Extensions.JsonRpc.dll" CertificateName="3PartySHA2" />
2019
<FileSignInfo Include="OmniSharp.Extensions.LanguageProtocol.dll" CertificateName="3PartySHA2" />
2120
<FileSignInfo Include="OmniSharp.Extensions.LanguageServer.dll" CertificateName="3PartySHA2" />
21+
<FileSignInfo Include="OmniSharp.Extensions.LanguageServer.Shared.dll" CertificateName="3PartySHA2" />
2222
</ItemGroup>
2323

2424
<ItemGroup>

eng/Versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
<MoqPackageVersion>4.10.0</MoqPackageVersion>
123123
<!-- STOP!!! We need to reference the version of JSON that our HOSTS supprt. -->
124124
<NewtonsoftJsonPackageVersion>12.0.2</NewtonsoftJsonPackageVersion>
125-
<OmniSharpExtensionsLanguageServerPackageVersion>0.14.2</OmniSharpExtensionsLanguageServerPackageVersion>
125+
<OmniSharpExtensionsLanguageServerPackageVersion>0.18.0-beta0081</OmniSharpExtensionsLanguageServerPackageVersion>
126126
<OmniSharpMSBuildPackageVersion>1.33.0</OmniSharpMSBuildPackageVersion>
127127
<SystemPrivateUriPackageVersion>4.3.2</SystemPrivateUriPackageVersion>
128128
<SystemCompositionPackageVersion>1.0.31.0</SystemCompositionPackageVersion>

src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer.Common/LanguageServerConstants.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,19 @@ public static class LanguageServerConstants
77
{
88
public const string ProjectConfigurationFile = "project.razor.json";
99

10-
public const string RazorSemanticTokensEndpoint = "textDocument/semanticTokens";
10+
// Semantic "Legacy" endpoints refer to an old LSP spec version, needed for now until VS reacts.
11+
public const string LegacyRazorSemanticTokensEndpoint = "textDocument/semanticTokens";
1112

12-
public const string RazorSemanticTokensEditEndpoint = "textDocument/semanticTokens/edits";
13+
public const string LegacyRazorSemanticTokensEditEndpoint = "textDocument/semanticTokens/edits";
1314

14-
public const string RazorSemanticTokensRangeEndpoint = "textDocument/semanticTokens/range";
15+
public const string LegacyRazorSemanticTokensRangeEndpoint = "textDocument/semanticTokens/range";
1516

1617
public const string RazorSemanticTokensLegendEndpoint = "_ms_/textDocument/semanticTokensLegend";
1718

19+
public const string RazorSemanticTokensEditEndpoint = "textDocument/semanticTokens/full/delta";
20+
21+
public const string RazorSemanticTokensEndpoint = "textDocument/semanticTokens/full";
22+
1823
public const string SemanticTokensProviderName = "semanticTokensProvider";
1924

2025
public const string RazorRangeFormattingEndpoint = "razor/rangeFormatting";

src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionEndpoint.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
using Microsoft.CodeAnalysis.Razor.Workspaces;
1515
using Microsoft.CodeAnalysis.Text;
1616
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
17+
using OmniSharp.Extensions.LanguageServer.Protocol.Document;
1718
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
1819
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
19-
using LanguageServerInstance = OmniSharp.Extensions.LanguageServer.Server.LanguageServer;
2020

2121
namespace Microsoft.AspNetCore.Razor.LanguageServer.CodeActions
2222
{
@@ -25,8 +25,8 @@ internal class CodeActionEndpoint : ICodeActionHandler
2525
private readonly IEnumerable<RazorCodeActionProvider> _providers;
2626
private readonly ForegroundDispatcher _foregroundDispatcher;
2727
private readonly DocumentResolver _documentResolver;
28-
private readonly ILanguageServer _languageServer;
2928
private readonly LanguageServerFeatureOptions _languageServerFeatureOptions;
29+
private readonly IClientLanguageServer _languageServer;
3030

3131
private CodeActionCapability _capability;
3232

@@ -36,7 +36,7 @@ public CodeActionEndpoint(
3636
IEnumerable<RazorCodeActionProvider> providers,
3737
ForegroundDispatcher foregroundDispatcher,
3838
DocumentResolver documentResolver,
39-
ILanguageServer languageServer,
39+
IClientLanguageServer languageServer,
4040
LanguageServerFeatureOptions languageServerFeatureOptions)
4141
{
4242
_providers = providers ?? throw new ArgumentNullException(nameof(providers));
@@ -63,8 +63,7 @@ public void SetCapability(CodeActionCapability capability)
6363
{
6464
_capability = capability;
6565

66-
var languageServerInstance = _languageServer as LanguageServerInstance;
67-
var extendableClientCapabilities = languageServerInstance?.ClientSettings?.Capabilities as ExtendableClientCapabilities;
66+
var extendableClientCapabilities = _languageServer.ClientSettings?.Capabilities as ExtendableClientCapabilities;
6867
_supportsCodeActionResolve = extendableClientCapabilities?.SupportsCodeActionResolve ?? false;
6968
}
7069

src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/ComponentAccessibilityCodeActionProvider.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using Microsoft.AspNetCore.Razor.LanguageServer.Common;
1616
using Microsoft.CodeAnalysis.Razor;
1717
using Microsoft.VisualStudio.Editor.Razor;
18+
using OmniSharp.Extensions.LanguageServer.Protocol;
1819
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
1920

2021
namespace Microsoft.AspNetCore.Razor.LanguageServer.CodeActions
@@ -216,7 +217,7 @@ private static WorkspaceEdit CreateRenameTagEdit(RazorCodeActionContext context,
216217

217218
return new WorkspaceEdit
218219
{
219-
Changes = new Dictionary<Uri, IEnumerable<TextEdit>> {
220+
Changes = new Dictionary<DocumentUri, IEnumerable<TextEdit>> {
220221
[context.Request.TextDocument.Uri] = changes,
221222
}
222223
};
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4-
using System;
4+
using OmniSharp.Extensions.LanguageServer.Protocol;
55

66
namespace Microsoft.AspNetCore.Razor.LanguageServer.CodeActions.Models
77
{
88
internal sealed class AddUsingsCodeActionParams
99
{
10-
public Uri Uri { get; set; }
10+
public DocumentUri Uri { get; set; }
1111
public string Namespace { get; set; }
1212
}
1313
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4-
using System;
4+
using OmniSharp.Extensions.LanguageServer.Protocol;
55

66
namespace Microsoft.AspNetCore.Razor.LanguageServer.CodeActions.Models
77
{
88
internal sealed class CreateComponentCodeActionParams
99
{
10-
public Uri Uri { get; set; }
10+
public DocumentUri Uri { get; set; }
1111
public string Path { get; set; }
1212
}
1313
}

src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Models/ExtractToCodeBehindCodeActionParams.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4-
using System;
4+
using OmniSharp.Extensions.LanguageServer.Protocol;
55

66
namespace Microsoft.AspNetCore.Razor.LanguageServer.CodeActions.Models
77
{
88
internal sealed class ExtractToCodeBehindCodeActionParams
99
{
10-
public Uri Uri { get; set; }
10+
public DocumentUri Uri { get; set; }
1111
public int ExtractStart { get; set; }
1212
public int ExtractEnd { get; set; }
1313
public int RemoveStart { get; set; }

src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/DefaultTagHelperDescriptionFactory.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
using System.Text.RegularExpressions;
99
using Microsoft.CodeAnalysis.Razor.Completion;
1010
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
11-
using OmniSharp.Extensions.LanguageServer.Server;
11+
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
1212
using RazorAttributeDescriptionInfo = Microsoft.CodeAnalysis.Razor.Completion.AttributeDescriptionInfo;
1313

1414
namespace Microsoft.AspNetCore.Razor.LanguageServer.Completion
@@ -36,17 +36,21 @@ internal class DefaultTagHelperDescriptionFactory : TagHelperDescriptionFactory
3636
[typeof(decimal).FullName] = "decimal",
3737
};
3838

39-
public DefaultTagHelperDescriptionFactory(ILanguageServer languageServer)
39+
private readonly Lazy<ILanguageServer> _server;
40+
41+
// Need to have a lazy server here because if we try to resolve the server it creates types which create a DefaultTagHelperDescriptionFactory, and we end up StackOverflowing.
42+
// This lazy can be avoided in the future by using an upcoming ILanguageServerSettings interface, but it doesn't exist/work yet.
43+
public DefaultTagHelperDescriptionFactory(Lazy<ILanguageServer> languageServer)
4044
{
4145
if (languageServer is null)
4246
{
4347
throw new NotImplementedException(nameof(languageServer));
4448
}
4549

46-
LanguageServer = languageServer;
50+
_server = languageServer;
4751
}
4852

49-
public ILanguageServer LanguageServer { get; }
53+
public ILanguageServer LanguageServer => _server.Value;
5054

5155
public override bool TryCreateDescription(ElementDescriptionInfo elementDescriptionInfo, out MarkupContent tagHelperDescription)
5256
{

src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
using Microsoft.CodeAnalysis.Text;
1616
using Microsoft.Extensions.Logging;
1717
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
18+
using OmniSharp.Extensions.LanguageServer.Protocol.Document;
1819
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
19-
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
2020

2121
namespace Microsoft.AspNetCore.Razor.LanguageServer.Completion
2222
{

0 commit comments

Comments
 (0)