Skip to content

Commit

Permalink
Fix PowerShell#396: Extension commands loaded in profile are not bein…
Browse files Browse the repository at this point in the history
…g 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.
  • Loading branch information
daviwil committed Dec 19, 2016
1 parent 54e3784 commit bda32ef
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,11 @@ export class SessionManager {
connectFunc,
clientOptions);

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

this.languageServerClient.onReady().then(
() => {
this.languageServerClient
Expand All @@ -345,19 +350,19 @@ export class SessionManager {
? `${this.versionDetails.displayVersion} (${this.versionDetails.architecture})`
: this.versionDetails.displayVersion,
SessionStatus.Running);

this.updateExtensionFeatures(this.languageServerClient)
});
},
(reason) => {
this.setSessionFailure("Could not start language service: ", reason);
this.updateExtensionFeatures(undefined);
});

this.languageServerClient.start();
}
catch (e)
{
this.setSessionFailure("The language service could not be started: ", e);
this.updateExtensionFeatures(undefined);
}
}

Expand Down

0 comments on commit bda32ef

Please sign in to comment.