Skip to content

Commit b25f4cd

Browse files
committed
Don't perform dynamic registration of server capabilities if client does not support any kind of dynamic registration.
As noted by LSP protocol docs, clients do not have to support this: https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#new-register-capability
1 parent b2d6d6b commit b25f4cd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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)