Skip to content

Commit 4389c7b

Browse files
Merge pull request #20 from tintoy/master
Skip dynamic registration of server capabilities if client does not support it
2 parents b2d6d6b + cdb35a9 commit 4389c7b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/JsonRpc/JsonRpc.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<PropertyGroup>
33
<TargetFrameworks>net46;netstandard1.6</TargetFrameworks>
44
<PlatformTarget>AnyCPU</PlatformTarget>
5+
<LangVersion>Latest</LangVersion>
56
<!-- Needed for Microsoft.Composition -->
67
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dotnet5.4;portable-net45+win8</PackageTargetFallback>
78
<PackageVersion Condition="'$(GitVersion_NuGetVersion)' != ''">$(GitVersion_NuGetVersion)</PackageVersion>

src/Lsp/LanguageServer.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Concurrent;
33
using System.Collections.Generic;
44
using System.IO;
@@ -213,6 +213,9 @@ private async Task DynamicallyRegisterHandlers()
213213
registrations.Add(handler.Registration);
214214
}
215215

216+
if (registrations.Count == 0)
217+
return; // No dynamic registrations supported by client.
218+
216219
var @params = new RegistrationParams() { Registrations = registrations };
217220

218221
await this.RegisterCapability(@params);
@@ -260,4 +263,4 @@ public void Dispose()
260263

261264
public IDictionary<string, JToken> Experimental { get; } = new Dictionary<string, JToken>();
262265
}
263-
}
266+
}

0 commit comments

Comments
 (0)