Skip to content

Commit 8460bd0

Browse files
Initial support to get 3.17 features all working
1 parent ce5dadc commit 8460bd0

File tree

187 files changed

+13682
-3647
lines changed

Some content is hidden

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

187 files changed

+13682
-3647
lines changed

Directory.Packages.props

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@
3535
<PackageVersion Include="Microsoft.Extensions.Options" Version="6.0.0" />
3636
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="6.0.0" />
3737
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
38-
<PackageVersion Include="Newtonsoft.Json" Version="11.0.2" />
38+
<PackageVersion Include="Newtonsoft.Json" Version="13.0.1" />
3939
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
4040
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.4" />
4141
<PackageVersion Include="xunit" Version="2.4.1" />
4242
<PackageVersion Include="FluentAssertions" Version="6.6.0" />
43+
<PackageVersion Include="Verify.Xunit" Version="16.8.1" />
44+
<PackageVersion Include="Verify.SourceGenerators" Version="1.5.0-beta.1" />
4345
<PackageVersion Include="NSubstitute" Version="4.3.0" />
4446
<PackageVersion Include="Serilog.Extensions.Logging" Version="3.1.0" />
4547
<PackageVersion Include="Serilog.Sinks.Observable" Version="2.0.2" />

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "6.0.200",
3+
"version": "6.0.300",
44
"rollForward": "latestMinor"
55
}
66
}

language-server-protocol.sha.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
-- This is the last commit we caught up with https://github.com/Microsoft/language-server-protocol/commits/gh-pages
22
lastSha: bdcc0f2
33

4-
https://github.com/Microsoft/language-server-protocol/compare/bdcc0f2..gh-pages
4+
https://github.com/Microsoft/language-server-protocol/compare/ed804013dc545b0e10bcb0a57d872c414bbc1f3c..gh-pages
5+

sample/SampleServer/FoldingRangeHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ internal class FoldingRangeHandler : IFoldingRangeHandler
1010
{
1111
public FoldingRangeRegistrationOptions GetRegistrationOptions() =>
1212
new FoldingRangeRegistrationOptions {
13-
DocumentSelector = DocumentSelector.ForLanguage("csharp")
13+
DocumentSelector = TextDocumentSelector.ForLanguage("csharp")
1414
};
1515

1616
public Task<Container<FoldingRange>?> Handle(
@@ -30,7 +30,7 @@ CancellationToken cancellationToken
3030
);
3131

3232
public FoldingRangeRegistrationOptions GetRegistrationOptions(FoldingRangeCapability capability, ClientCapabilities clientCapabilities) => new FoldingRangeRegistrationOptions {
33-
DocumentSelector = DocumentSelector.ForLanguage("csharp")
33+
DocumentSelector = TextDocumentSelector.ForLanguage("csharp")
3434
};
3535
}
3636
}

sample/SampleServer/SemanticTokensHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ protected override SemanticTokensRegistrationOptions CreateRegistrationOptions(
9595
{
9696
return new SemanticTokensRegistrationOptions
9797
{
98-
DocumentSelector = DocumentSelector.ForLanguage("csharp"),
98+
DocumentSelector = TextDocumentSelector.ForLanguage("csharp"),
9999
Legend = new SemanticTokensLegend
100100
{
101101
TokenModifiers = capability.TokenModifiers,

sample/SampleServer/TextDocumentHandler.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ internal class TextDocumentHandler : TextDocumentSyncHandlerBase
2525
private readonly ILogger<TextDocumentHandler> _logger;
2626
private readonly ILanguageServerConfiguration _configuration;
2727

28-
private readonly DocumentSelector _documentSelector = new DocumentSelector(
29-
new DocumentFilter {
28+
private readonly TextDocumentSelector _textDocumentSelector = new TextDocumentSelector(
29+
new TextDocumentFilter {
3030
Pattern = "**/*.cs"
3131
}
3232
);
@@ -69,8 +69,8 @@ public override Task<Unit> Handle(DidCloseTextDocumentParams notification, Cance
6969

7070
public override Task<Unit> Handle(DidSaveTextDocumentParams notification, CancellationToken token) => Unit.Task;
7171

72-
protected override TextDocumentSyncRegistrationOptions CreateRegistrationOptions(SynchronizationCapability capability, ClientCapabilities clientCapabilities) => new TextDocumentSyncRegistrationOptions() {
73-
DocumentSelector = _documentSelector,
72+
protected override TextDocumentSyncRegistrationOptions CreateRegistrationOptions(TextSynchronizationCapability capability, ClientCapabilities clientCapabilities) => new TextDocumentSyncRegistrationOptions() {
73+
DocumentSelector = _textDocumentSelector,
7474
Change = Change,
7575
Save = new SaveOptions() { IncludeText = true }
7676
};
@@ -129,7 +129,7 @@ CancellationToken cancellationToken
129129
}
130130

131131
public DocumentSymbolRegistrationOptions GetRegistrationOptions(DocumentSymbolCapability capability, ClientCapabilities clientCapabilities) => new DocumentSymbolRegistrationOptions {
132-
DocumentSelector = DocumentSelector.ForLanguage("csharp")
132+
DocumentSelector = TextDocumentSelector.ForLanguage("csharp")
133133
};
134134
}
135135

src/Client/DefaultLanguageClientFacade.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ namespace OmniSharp.Extensions.LanguageServer.Client
1313
internal class DefaultLanguageClientFacade : LanguageProtocolProxy, ILanguageClientFacade, IOnLanguageClientStarted
1414
{
1515
private readonly Lazy<ITextDocumentLanguageClient> _textDocument;
16+
private readonly Lazy<INotebookDocumentLanguageClient> _notebookDocument;
1617
private readonly Lazy<IClientLanguageClient> _client;
1718
private readonly Lazy<IGeneralLanguageClient> _general;
1819
private readonly Lazy<IWindowLanguageClient> _window;
@@ -28,6 +29,7 @@ public DefaultLanguageClientFacade(
2829
IProgressManager progressManager,
2930
ILanguageProtocolSettings languageProtocolSettings,
3031
Lazy<ITextDocumentLanguageClient> textDocument,
32+
Lazy<INotebookDocumentLanguageClient> notebookDocument,
3133
Lazy<IClientLanguageClient> client,
3234
Lazy<IGeneralLanguageClient> general,
3335
Lazy<IWindowLanguageClient> window,
@@ -38,6 +40,7 @@ IInsanceHasStarted instanceHasStarted
3840
) : base(requestRouter, resolverContext, progressManager, languageProtocolSettings)
3941
{
4042
_textDocument = textDocument;
43+
_notebookDocument = notebookDocument;
4144
_client = client;
4245
_general = general;
4346
_window = window;
@@ -48,6 +51,7 @@ IInsanceHasStarted instanceHasStarted
4851
}
4952

5053
public ITextDocumentLanguageClient TextDocument => _textDocument.Value;
54+
public INotebookDocumentLanguageClient NotebookDocument => _notebookDocument.Value;
5155
public IClientLanguageClient Client => _client.Value;
5256
public IGeneralLanguageClient General => _general.Value;
5357
public IWindowLanguageClient Window => _window.Value;

src/Client/LanguageClient.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ internal LanguageClient(
177177
IEnumerable<OnLanguageClientStartedDelegate> startedDelegates,
178178
IEnumerable<IOnLanguageClientStarted> startedHandlers,
179179
ITextDocumentLanguageClient textDocumentLanguageClient,
180+
INotebookDocumentLanguageClient notebookDocumentLanguageClient,
180181
IClientLanguageClient clientLanguageClient,
181182
IGeneralLanguageClient generalLanguageClient,
182183
IWindowLanguageClient windowLanguageClient,
@@ -228,13 +229,15 @@ IScheduler scheduler
228229

229230
// We need to at least create Window here in case any handler does loggin in their constructor
230231
TextDocument = textDocumentLanguageClient;
232+
NotebookDocument = notebookDocumentLanguageClient;
231233
Client = clientLanguageClient;
232234
General = generalLanguageClient;
233235
Window = windowLanguageClient;
234236
Workspace = workspaceLanguageClient;
235237
}
236238

237239
public ITextDocumentLanguageClient TextDocument { get; }
240+
public INotebookDocumentLanguageClient NotebookDocument { get; }
238241
public IClientLanguageClient Client { get; }
239242
public IGeneralLanguageClient General { get; }
240243
public IWindowLanguageClient Window { get; }

src/Client/LanguageClientRegistrationManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,14 @@ public IObservable<IEnumerable<Registration>> Registrations
180180

181181
public IEnumerable<Registration> GetRegistrationsForMethod(string method) => _registrations.Select(z => z.Value).Where(x => x.Method == method);
182182

183-
public IEnumerable<Registration> GetRegistrationsMatchingSelector(DocumentSelector documentSelector) =>
183+
public IEnumerable<Registration> GetRegistrationsMatchingSelector(TextDocumentSelector textDocumentSelector) =>
184184
_registrations
185185
.Select(z => z.Value)
186186
.Where(
187187
x => x.RegisterOptions is ITextDocumentRegistrationOptions { DocumentSelector: { } } ro &&
188188
ro.DocumentSelector
189189
.Join(
190-
documentSelector,
190+
textDocumentSelector,
191191
z => z.HasLanguage ? z.Language :
192192
z.HasScheme ? z.Scheme :
193193
z.HasPattern ? z.Pattern : string.Empty,

src/Client/LanguageClientServiceCollectionExtensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ internal static IContainer AddLanguageClientInternals(this IContainer container,
4444
container.RegisterMany<TextDocumentLanguageClient>(
4545
serviceTypeCondition: type => type.Name.Contains(nameof(TextDocumentLanguageClient)), reuse: Reuse.Singleton
4646
);
47+
container.RegisterMany<NotebookDocumentLanguageClient>(
48+
serviceTypeCondition: type => type.Name.Contains(nameof(NotebookDocumentLanguageClient)), reuse: Reuse.Singleton
49+
);
4750
container.RegisterMany<ClientLanguageClient>(
4851
serviceTypeCondition: type => type.Name.Contains(nameof(ClientLanguageClient)), reuse: Reuse.Singleton
4952
);

src/Dap.Protocol/Dap.Protocol.csproj

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,24 @@
1414

1515
<ItemGroup>
1616
<ProjectReference Include="..\JsonRpc\JsonRpc.csproj" />
17-
<ProjectReference
18-
Include="..\JsonRpc.Generators\JsonRpc.Generators.csproj"
19-
IncludeAssets="analyzers"
20-
ExcludeAssets="compile;runtime;native"
21-
PrivateAssets="contentfiles;build;buildMultitargeting;buildTransitive"
22-
OutputItemType="Analyzer"
23-
/>
17+
<ProjectReference Include="..\JsonRpc.Generators\JsonRpc.Generators.csproj" IncludeAssets="analyzers" ExcludeAssets="compile;runtime;native" PrivateAssets="contentfiles;build;buildMultitargeting;buildTransitive" OutputItemType="Analyzer" />
2418
</ItemGroup>
2519

2620
<ItemGroup>
2721
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
28-
<_Parameter1
29-
>OmniSharp.Extensions.DebugAdapter.Testing, PublicKey=0024000004800000940000000602000000240000525341310004000001000100391db875e68eb4bfef49ce14313b9e13f2cd3cc89eb273bbe6c11a55044c7d4f566cf092e1c77ef9e7c75b1496ae7f95d925938f5a01793dd8d9f99ae0a7595779b71b971287d7d7b5960d052078d14f5ce1a85ea5c9fb2f59ac735ff7bc215cab469b7c3486006860bad6f4c3b5204ea2f28dd4e1d05e2cca462cfd593b9f9f</_Parameter1>
22+
<_Parameter1>OmniSharp.Extensions.DebugAdapter.Testing, PublicKey=0024000004800000940000000602000000240000525341310004000001000100391db875e68eb4bfef49ce14313b9e13f2cd3cc89eb273bbe6c11a55044c7d4f566cf092e1c77ef9e7c75b1496ae7f95d925938f5a01793dd8d9f99ae0a7595779b71b971287d7d7b5960d052078d14f5ce1a85ea5c9fb2f59ac735ff7bc215cab469b7c3486006860bad6f4c3b5204ea2f28dd4e1d05e2cca462cfd593b9f9f</_Parameter1>
3023
</AssemblyAttribute>
3124
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
32-
<_Parameter1
33-
>OmniSharp.Extensions.DebugAdapter.Server, PublicKey=0024000004800000940000000602000000240000525341310004000001000100391db875e68eb4bfef49ce14313b9e13f2cd3cc89eb273bbe6c11a55044c7d4f566cf092e1c77ef9e7c75b1496ae7f95d925938f5a01793dd8d9f99ae0a7595779b71b971287d7d7b5960d052078d14f5ce1a85ea5c9fb2f59ac735ff7bc215cab469b7c3486006860bad6f4c3b5204ea2f28dd4e1d05e2cca462cfd593b9f9f</_Parameter1>
25+
<_Parameter1>OmniSharp.Extensions.DebugAdapter.Server, PublicKey=0024000004800000940000000602000000240000525341310004000001000100391db875e68eb4bfef49ce14313b9e13f2cd3cc89eb273bbe6c11a55044c7d4f566cf092e1c77ef9e7c75b1496ae7f95d925938f5a01793dd8d9f99ae0a7595779b71b971287d7d7b5960d052078d14f5ce1a85ea5c9fb2f59ac735ff7bc215cab469b7c3486006860bad6f4c3b5204ea2f28dd4e1d05e2cca462cfd593b9f9f</_Parameter1>
3426
</AssemblyAttribute>
3527
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
36-
<_Parameter1
37-
>OmniSharp.Extensions.DebugAdapter.Client, PublicKey=0024000004800000940000000602000000240000525341310004000001000100391db875e68eb4bfef49ce14313b9e13f2cd3cc89eb273bbe6c11a55044c7d4f566cf092e1c77ef9e7c75b1496ae7f95d925938f5a01793dd8d9f99ae0a7595779b71b971287d7d7b5960d052078d14f5ce1a85ea5c9fb2f59ac735ff7bc215cab469b7c3486006860bad6f4c3b5204ea2f28dd4e1d05e2cca462cfd593b9f9f</_Parameter1>
28+
<_Parameter1>OmniSharp.Extensions.DebugAdapter.Client, PublicKey=0024000004800000940000000602000000240000525341310004000001000100391db875e68eb4bfef49ce14313b9e13f2cd3cc89eb273bbe6c11a55044c7d4f566cf092e1c77ef9e7c75b1496ae7f95d925938f5a01793dd8d9f99ae0a7595779b71b971287d7d7b5960d052078d14f5ce1a85ea5c9fb2f59ac735ff7bc215cab469b7c3486006860bad6f4c3b5204ea2f28dd4e1d05e2cca462cfd593b9f9f</_Parameter1>
3829
</AssemblyAttribute>
3930
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
40-
<_Parameter1
41-
>OmniSharp.Extensions.DebugAdapter.Shared, PublicKey=0024000004800000940000000602000000240000525341310004000001000100391db875e68eb4bfef49ce14313b9e13f2cd3cc89eb273bbe6c11a55044c7d4f566cf092e1c77ef9e7c75b1496ae7f95d925938f5a01793dd8d9f99ae0a7595779b71b971287d7d7b5960d052078d14f5ce1a85ea5c9fb2f59ac735ff7bc215cab469b7c3486006860bad6f4c3b5204ea2f28dd4e1d05e2cca462cfd593b9f9f</_Parameter1>
31+
<_Parameter1>OmniSharp.Extensions.DebugAdapter.Shared, PublicKey=0024000004800000940000000602000000240000525341310004000001000100391db875e68eb4bfef49ce14313b9e13f2cd3cc89eb273bbe6c11a55044c7d4f566cf092e1c77ef9e7c75b1496ae7f95d925938f5a01793dd8d9f99ae0a7595779b71b971287d7d7b5960d052078d14f5ce1a85ea5c9fb2f59ac735ff7bc215cab469b7c3486006860bad6f4c3b5204ea2f28dd4e1d05e2cca462cfd593b9f9f</_Parameter1>
4232
</AssemblyAttribute>
4333
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
44-
<_Parameter1
45-
>OmniSharp.Extensions.DebugAdapter.Proposals, PublicKey=0024000004800000940000000602000000240000525341310004000001000100391db875e68eb4bfef49ce14313b9e13f2cd3cc89eb273bbe6c11a55044c7d4f566cf092e1c77ef9e7c75b1496ae7f95d925938f5a01793dd8d9f99ae0a7595779b71b971287d7d7b5960d052078d14f5ce1a85ea5c9fb2f59ac735ff7bc215cab469b7c3486006860bad6f4c3b5204ea2f28dd4e1d05e2cca462cfd593b9f9f</_Parameter1>
34+
<_Parameter1>OmniSharp.Extensions.DebugAdapter.Proposals, PublicKey=0024000004800000940000000602000000240000525341310004000001000100391db875e68eb4bfef49ce14313b9e13f2cd3cc89eb273bbe6c11a55044c7d4f566cf092e1c77ef9e7c75b1496ae7f95d925938f5a01793dd8d9f99ae0a7595779b71b971287d7d7b5960d052078d14f5ce1a85ea5c9fb2f59ac735ff7bc215cab469b7c3486006860bad6f4c3b5204ea2f28dd4e1d05e2cca462cfd593b9f9f</_Parameter1>
4635
</AssemblyAttribute>
4736
</ItemGroup>
4837
</Project>

src/JsonRpc.Generators/ActionContextExtensions.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
using Microsoft.CodeAnalysis.CSharp;
22
using Microsoft.CodeAnalysis.CSharp.Syntax;
33
using OmniSharp.Extensions.JsonRpc.Generators.Contexts;
4+
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
45

56
namespace OmniSharp.Extensions.JsonRpc.Generators
67
{
78
static class ActionContextExtensions
89
{
910
public static ParameterListSyntax GetRegistryParameterList(this ExtensionMethodContext extensionMethodContext)
1011
{
11-
return SyntaxFactory.ParameterList(
12-
SyntaxFactory.SeparatedList(
12+
return ParameterList(
13+
SeparatedList(
1314
new[] {
14-
SyntaxFactory.Parameter(SyntaxFactory.Identifier("registry"))
15+
Parameter(Identifier("registry"))
1516
.WithType(extensionMethodContext.Item)
16-
.WithModifiers(SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.ThisKeyword)))
17+
.WithModifiers(TokenList(Token(SyntaxKind.ThisKeyword)))
1718
}
1819
)
1920
);

src/JsonRpc.Generators/AutoImplementParamsGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class AutoImplementParamsGenerator : IIncrementalGenerator
1616
public void Initialize(IncrementalGeneratorInitializationContext context)
1717
{
1818
var _attributes = "Method,RegistrationOptions";
19-
var _interfaces = "IPartialItemsRequest,IPartialItemRequest,IWorkDoneProgressParams,IHandlerIdentity";
19+
var _interfaces = "IPartialItemsRequest,IPartialItemsWithInitialValueRequest,IPartialItemRequest,IPartialItemWithInitialValueRequest,IWorkDoneProgressParams,IHandlerIdentity";
2020

2121
var syntaxProvider = context.SyntaxProvider.CreateSyntaxProvider(
2222
(syntaxNode, _) =>
@@ -102,7 +102,7 @@ private static IEnumerable<MemberDeclarationSyntax> AutoImplementInterfaces(Base
102102
.WithAccessorList(GetInitAccessor);
103103
}
104104

105-
if (syntax.BaseList?.Types.Any(z => z.Type.GetSyntaxName() is "IPartialItemsRequest" or "IPartialItemRequest") == true
105+
if (syntax.BaseList?.Types.Any(z => z.Type.GetSyntaxName() is "IPartialItemsRequest" or "IPartialItemRequest" or "IPartialItemsWithInitialValueRequest" or "IPartialItemWithInitialValueRequest") == true
106106
&& symbol.GetMembers("PartialResultToken").IsEmpty)
107107
{
108108
yield return PropertyDeclaration(NullableType(IdentifierName("ProgressToken")), Identifier("PartialResultToken"))

src/JsonRpc.Generators/Contexts/GeneratorData.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ HashSet<string> additionalUsings
5656
GetRegistrationOptions(candidateClass, symbol, lspAttributes),
5757
GetPartialItem(candidateClass, symbol, requestType),
5858
GetPartialItems(candidateClass, symbol, requestType),
59+
symbol.AllInterfaces.Concat(requestType.Symbol.AllInterfaces).Any(z => z.Name.EndsWith("WithInitialValue", StringComparison.Ordinal)),
5960
additionalUsings,
6061
new List<AttributeArgumentSyntax>(),
6162
model, compilation

0 commit comments

Comments
 (0)