Skip to content

Commit b8844d1

Browse files
author
Kapil Borle
committed
Initialize event handler after client is ready
1 parent 49334de commit b8844d1

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/session.ts

+9-8
Original file line numberDiff line numberDiff line change
@@ -456,10 +456,6 @@ export class SessionManager {
456456
connectFunc,
457457
clientOptions);
458458

459-
// Send the new LanguageClient to extension features
460-
// so that they can register their message handlers
461-
// before the connection is established.
462-
this.updateExtensionFeatures(this.languageServerClient);
463459

464460
this.languageServerClient.onReady().then(
465461
() => {
@@ -474,14 +470,19 @@ export class SessionManager {
474470
: this.versionDetails.displayVersion,
475471
SessionStatus.Running);
476472
});
473+
474+
// Send the new LanguageClient to extension features
475+
// so that they can register their message handlers
476+
// before the connection is established.
477+
this.updateExtensionFeatures(this.languageServerClient);
478+
this.languageServerClient.onNotification(
479+
RunspaceChangedEvent.type,
480+
(runspaceDetails) => { this.setStatusBarVersionString(runspaceDetails); });
477481
},
478482
(reason) => {
479483
this.setSessionFailure("Could not start language service: ", reason);
480484
});
481485

482-
this.languageServerClient.onNotification(
483-
RunspaceChangedEvent.type,
484-
(runspaceDetails) => { this.setStatusBarVersionString(runspaceDetails); });
485486

486487
this.languageServerClient.start();
487488
}
@@ -768,4 +769,4 @@ export interface RunspaceDetails {
768769

769770
export namespace RunspaceChangedEvent {
770771
export const type = new NotificationType<RunspaceDetails, void>('powerShell/runspaceChanged');
771-
}
772+
}

0 commit comments

Comments
 (0)