Skip to content

Commit 3f56706

Browse files
Set server receiver to initialized at the end of the initialize request (#589)
1 parent d1daf4b commit 3f56706

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Server/LanguageServer.cs

+6-2
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,15 @@ await LanguageProtocolEventingHelper.Run(
313313
).ConfigureAwait(false);
314314

315315

316+
// Allow the server receiver to start processing incoming notifications and requests. It
317+
// is necessary to do this now, and not in the Initialized handler, because otherwise
318+
// clients can enter a race with the receiver and have their notifications and requests
319+
// erroneously dropped.
320+
_serverReceiver.Initialized();
321+
316322
// TODO:
317323
if (_clientVersion == ClientVersion.Lsp2)
318324
{
319-
_serverReceiver.Initialized();
320325
_initializeComplete.OnNext(result);
321326
_initializeComplete.OnCompleted();
322327
}
@@ -328,7 +333,6 @@ public Task<Unit> Handle(InitializedParams @params, CancellationToken token)
328333
{
329334
if (_clientVersion == ClientVersion.Lsp3)
330335
{
331-
_serverReceiver.Initialized();
332336
_initializeComplete.OnNext(ServerSettings);
333337
_initializeComplete.OnCompleted();
334338
}

0 commit comments

Comments
 (0)