Skip to content

Commit bda32ef

Browse files
committed
Fix #396: Extension commands loaded in profile are not being registered
This change fixes an issue caused by the recent extension code refactoring which prevents extension commands from being registered in the extension when loaded in the user's profile. This was caused by the LanguageClient not being given to the ExtensionCommandsFeature early enough for it to register its handler for the extensionCommandAdded event from the language server.
1 parent 54e3784 commit bda32ef

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/session.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,11 @@ export class SessionManager {
333333
connectFunc,
334334
clientOptions);
335335

336+
// Send the new LanguageClient to extension features
337+
// so that they can register their message handlers
338+
// before the connection is established.
339+
this.updateExtensionFeatures(this.languageServerClient);
340+
336341
this.languageServerClient.onReady().then(
337342
() => {
338343
this.languageServerClient
@@ -345,19 +350,19 @@ export class SessionManager {
345350
? `${this.versionDetails.displayVersion} (${this.versionDetails.architecture})`
346351
: this.versionDetails.displayVersion,
347352
SessionStatus.Running);
348-
349-
this.updateExtensionFeatures(this.languageServerClient)
350353
});
351354
},
352355
(reason) => {
353356
this.setSessionFailure("Could not start language service: ", reason);
357+
this.updateExtensionFeatures(undefined);
354358
});
355359

356360
this.languageServerClient.start();
357361
}
358362
catch (e)
359363
{
360364
this.setSessionFailure("The language service could not be started: ", e);
365+
this.updateExtensionFeatures(undefined);
361366
}
362367
}
363368

0 commit comments

Comments
 (0)