Skip to content

Remove popup when extension updates #4105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ export async function activate(context: vscode.ExtensionContext): Promise<IPower
"'PowerShell' and 'PowerShell Preview' are both enabled. Please disable one for best performance.");
}

// This displays a popup and a changelog after an update.
checkForUpdatedVersion(context, PackageJSON.version);

// Load and validate settings (will prompt for 'cwd' if necessary).
await Settings.validateCwdSetting();
const extensionSettings = Settings.load();
Expand Down Expand Up @@ -184,35 +181,6 @@ export async function activate(context: vscode.ExtensionContext): Promise<IPower
};
}

function checkForUpdatedVersion(context: vscode.ExtensionContext, version: string) {

const showReleaseNotes = "Show Release Notes";
const powerShellExtensionVersionKey = "powerShellExtensionVersion";

const storedVersion = context.globalState.get(powerShellExtensionVersionKey);

if (!storedVersion) {
// TODO: Prompt to show User Guide for first-time install
} else if (version !== storedVersion) {
vscode
.window
.showInformationMessage(
`The PowerShell extension has been updated to version ${version}!`,
showReleaseNotes)
.then((choice) => {
if (choice === showReleaseNotes) {
vscode.commands.executeCommand(
"markdown.showPreview",
vscode.Uri.file(path.resolve(__dirname, "../CHANGELOG.md")));
}
});
}

context.globalState.update(
powerShellExtensionVersionKey,
version);
}

export function deactivate(): void {
// Clean up all extension features
languageClientConsumers.forEach((languageClientConsumer) => {
Expand Down