Skip to content

Commit cd7d7ac

Browse files
Make RoslynLanguageServer.start() no longer async
This method was accidentally doing a fire-and-forget since it didn't await the underlying launch of the client process. We believe that's what we want to continue to do, since awaiting the process launch is dangerous since that can potentially deadlock when you have our extension calling into Dev Kit or vice versa.
1 parent ab5a705 commit cd7d7ac

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/lsptoolshost/roslynLanguageServer.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,10 @@ export class RoslynLanguageServer {
150150
}
151151

152152
/**
153-
* Resolves server options and starts the dotnet language server process.
153+
* Resolves server options and starts the dotnet language server process. The process is started asynchronously and this method will not wait until
154+
* the process is launched.
154155
*/
155-
public async start(): Promise<void> {
156+
public start(): void {
156157
let options = this.optionProvider.GetLatestOptions();
157158
let logLevel = options.languageServerOptions.logLevel;
158159
const languageClientTraceLevel = this.GetTraceLevel(logLevel);
@@ -235,13 +236,13 @@ export class RoslynLanguageServer {
235236
}
236237

237238
/**
238-
* Restarts the language server.
239+
* Restarts the language server. This does not wait until the server has been restarted.
239240
* Note that since some options affect how the language server is initialized, we must
240-
* re-create the LanguageClient instance instead of just stopping/starting it.
241+
* re-create the LanguageClient instance instead of just stopping/starting it.
241242
*/
242243
public async restart(): Promise<void> {
243244
await this.stop();
244-
await this.start();
245+
this.start();
245246
}
246247

247248
/**
@@ -635,7 +636,7 @@ export async function activateRoslynLanguageServer(context: vscode.ExtensionCont
635636
});
636637

637638
// Start the language server.
638-
await _languageServer.start();
639+
_languageServer.start();
639640
}
640641

641642
async function applyAutoInsertEdit(e: vscode.TextDocumentChangeEvent, token: vscode.CancellationToken) {

0 commit comments

Comments
 (0)