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
);

0 commit comments

Comments
 (0)