Repository navigation
Settle start() with the outcome of an initialization retry #1924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Dirk Bäumer (dbaeumer)
merged 4 commits into
microsoft:main
from
trivikr:client-settle-start
Oct 30, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
e1229b6
Settle start() with the outcome of an initialization retry
trivikr f524cfa
Settle start() when the connection closes during the retry prompt
trivikr c0d5d02
Test the final error when a retried initialization fails
trivikr c419d9d
Merge branch 'main' into client-settle-start
dbaeumer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
client-node-tests/src/servers/exitOnInitializeRetryServer.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See License.txt in the project root for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
| import { createConnection, InitializeError, ResponseError } from 'vscode-languageserver/node'; | ||
| const connection = createConnection(); | ||
| connection.onInitialize(() => { | ||
| // Ask the client to retry, then exit while the client asks the user whether to retry. | ||
| setTimeout(() => process.exit(0), 100); | ||
| return new ResponseError<InitializeError>(1, 'Initialization refused', { retry: true }); | ||
| }); | ||
| connection.listen(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See License.txt in the project root for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
| import { createConnection, InitializeError, ResponseError } from 'vscode-languageserver/node'; | ||
| const connection = createConnection(); | ||
| let refused = false; | ||
| connection.onInitialize(() => { | ||
| // Refuse the first initialization and ask the client to retry, then accept the retry. | ||
| if (!refused) { | ||
| refused = true; | ||
| return new ResponseError<InitializeError>(1, 'Initialization refused', { retry: true }); | ||
| } | ||
| return { capabilities: {} }; | ||
| }); | ||
| connection.listen(); |
17 changes: 17 additions & 0 deletions
17
client-node-tests/src/servers/retryThenFailInitializeServer.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See License.txt in the project root for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
| import { createConnection, InitializeError, ResponseError } from 'vscode-languageserver/node'; | ||
| const connection = createConnection(); | ||
| let refused = false; | ||
| connection.onInitialize(() => { | ||
| // Refuse the first initialization and ask the client to retry, then fail the retry | ||
| // with a distinct error that can't be retried. | ||
| if (!refused) { | ||
| refused = true; | ||
| return new ResponseError<InitializeError>(1, 'Initialization refused', { retry: true }); | ||
| } | ||
| return new ResponseError<InitializeError>(1, 'Initialization failed after retry', { retry: false }); | ||
| }); | ||
| connection.listen(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.