diff --git a/package-lock.json b/package-lock.json index 3f560ea..55300e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "vscode-profile-switcher", - "version": "0.2.0", + "version": "0.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1783,6 +1783,11 @@ "https-proxy-agent": "^2.2.1" } }, + "vsls": { + "version": "0.3.1291", + "resolved": "https://registry.npmjs.org/vsls/-/vsls-0.3.1291.tgz", + "integrity": "sha512-8yJPN9p7k+XYyczOVtQmpun4K1CRDsw/hdnIzT/c40r5bIkpptfsBlHmmLemoIV+CAHvrTLdWKEf5OtRvdcn9A==" + }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", diff --git a/src/services/liveShare.ts b/src/services/liveShare.ts index 19397b7..6fee8d9 100644 --- a/src/services/liveShare.ts +++ b/src/services/liveShare.ts @@ -13,28 +13,21 @@ export async function initialize( } liveShare.onDidChangeSession(e => { - const liveShareProfile = config.getLiveShareProfile(); - if (!liveShareProfile) { - return; - } - if (e.session.id) { + const liveShareProfile = config.getLiveShareProfile(); + if (!liveShareProfile) { + return; + } + activateProfileHandler(liveShareProfile); } else { - restorePreviousProfile(config, activateProfileHandler); + const previousProfile = config.getPreviousProfile(); + if (!previousProfile) { + return; + } + + config.setPreviousProfile(undefined); + activateProfileHandler(previousProfile); } }) -} - -function restorePreviousProfile( - config: Config, - activateProfileHandler: (profile: string) => void -) { - const previousProfile = config.getPreviousProfile(); - if (!previousProfile) { - return; - } - - config.setPreviousProfile(undefined); - activateProfileHandler(previousProfile); } \ No newline at end of file