Skip to content
This repository has been archived by the owner on Jul 18, 2022. It is now read-only.

Commit

Permalink
Misc. cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lostintangent committed Jul 2, 2019
1 parent a7b1c1d commit 2cab0a7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async function activateProfile(
) {
let msg = vscode.window.setStatusBarMessage("Switching profiles.");

config.setCurrentProfile(profile);
await config.setCurrentProfile(profile);

let profileSettings = config.getProfileSettings(profile);
await settingsHelper.updateUserSettings(profileSettings);
Expand Down
4 changes: 2 additions & 2 deletions src/services/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ class Config {
return config.update(ConfigLiveShareProfileKey, profile, vscode.ConfigurationTarget.Global);
}

public setCurrentProfile(profile: string) {
public async setCurrentProfile(profile: string) {
if (this.context) {
const previousProfile = this.context.globalState.get<string>(ContextSettingCurrentProfile);
this.setPreviousProfile(previousProfile);

this.context.globalState.update(ContextSettingCurrentProfile, profile);
await this.context.globalState.update(ContextSettingCurrentProfile, profile);
}
}

Expand Down
15 changes: 5 additions & 10 deletions src/services/liveShare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,12 @@ export async function initialize(
return;
}

const liveShareProfile = config.getLiveShareProfile();
if (!liveShareProfile) {
return;
}

// Check to see whether there was a lingering profile set
// (e.g. because the user closed VS Code while in a Live Share
// session), and if so, restore the right profile.
restorePreviousProfile(config, activateProfileHandler);

liveShare.onDidChangeSession(e => {
const liveShareProfile = config.getLiveShareProfile();
if (!liveShareProfile) {
return;
}

if (e.session.id) {
activateProfileHandler(liveShareProfile);
} else {
Expand Down

0 comments on commit 2cab0a7

Please # to comment.