Skip to content

Retry language server start-up when its locale script fails to load - #1409

Merged
microbit-matt-hillsdon merged 2 commits into
mainfrom
language-server-init-retry
Nov 12, 2026
Merged

microbit-matt-hillsdon merged 2 commits into
mainfrom
language-server-init-retry

Conversation

@microbit-matt-hillsdon

Copy link
Copy Markdown
Collaborator

Pyright fetches its messages for the locale as the first step of
initialize. When that fetch failed while the browser reported being
online, the error was rethrown and the rejected promise kept, so the
session had no completions, signature help or diagnostics until a
reload. This is most of PYTHON-EDITOR-NEXT-3SJ.

Retry initialize with the same back-off as other lazy loads. Nothing
else has happened in the server at that point, so it can be sent again
on the same connection. If every attempt fails, a later call starts
afresh rather than replaying the failure.

The offline fallback to the precached locale now awaits its second
attempt and no longer loops if that fails too.

Pyright fetches its messages for the locale as the first step of
initialize. When that fetch failed while the browser reported being
online, the error was rethrown and the rejected promise kept, so the
session had no completions, signature help or diagnostics until a
reload. This is most of PYTHON-EDITOR-NEXT-3SJ.

Retry initialize with the same back-off as other lazy loads. Nothing
else has happened in the server at that point, so it can be sent again
on the same connection. If every attempt fails, a later call starts
afresh rather than replaying the failure.

The offline fallback to the precached locale now awaits its second
attempt and no longer loops if that fails too.
@github-actions

Copy link
Copy Markdown

pyright() awaited the cached client's initialize before comparing
languages. Now that a failed initialize can be tried again, a language
change after a failure would run a full round of retries for the old
locale, and give up without creating the new client if they failed.
Compare first and dispose a client for another language straight away.

Drop the handlersRegistered flag: vscode-jsonrpc keys handlers by
method, so registering again replaces them.

Relax the e2e request count so it doesn't depend on how many workers
Pyright starts.
@microbit-matt-hillsdon

Copy link
Copy Markdown
Collaborator Author

Tested basic initialisation and language switching and all seems good.

@microbit-matt-hillsdon
microbit-matt-hillsdon merged commit ece2106 into main Nov 12, 2026
3 checks passed
@microbit-matt-hillsdon
microbit-matt-hillsdon deleted the language-server-init-retry branch November 12, 2026 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant