Skip to content

Commit 3a3fe07

Browse files
feat(vscode): add reset binary command and improve self-update
- Add 'Reset RAZ Binary' command to clean up old binary management - Remove redundant binary download functions - Simplify update flow to use 'raz self-update' for v0.2.1+ - Fix typo: supportseSelfUpdate -> supportsSelfUpdate - Clean up duplicate Manual Update handlers
1 parent 145331d commit 3a3fe07

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

raz-adapters/vscode/src/extension.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,10 @@ async function checkForUpdates(context: vscode.ExtensionContext): Promise<void>
364364

365365
if (daysSince >= 7) { // Show update notification once per week
366366
// Check if the current version supports self-update (>=0.2.1)
367-
const supportseSelfUpdate = isVersionAtLeast(currentVersion, '0.2.1');
367+
const supportsSelfUpdate = isVersionAtLeast(currentVersion, '0.2.1');
368368

369369
let choice;
370-
if (supportseSelfUpdate) {
370+
if (supportsSelfUpdate) {
371371
choice = await vscode.window.showInformationMessage(
372372
`RAZ update available: v${currentVersion}${latestVersion}`,
373373
"Update with CLI",
@@ -579,10 +579,10 @@ export async function activate(
579579
}
580580

581581
const currentVersion = razVersion.replace('v', '');
582-
const supportseSelfUpdate = isVersionAtLeast(currentVersion, '0.2.1');
582+
const supportsSelfUpdate = isVersionAtLeast(currentVersion, '0.2.1');
583583

584584
let choice;
585-
if (supportseSelfUpdate) {
585+
if (supportsSelfUpdate) {
586586
choice = await vscode.window.showQuickPick([
587587
{ label: "Update with CLI", description: "Use 'raz self-update' command" },
588588
{ label: "Manual Update", description: "Show manual update instructions" }
@@ -648,9 +648,16 @@ export async function activate(
648648
const config = vscode.workspace.getConfiguration("raz");
649649
await config.update("path", "", vscode.ConfigurationTarget.Global);
650650

651-
// Clear old binary manager storage
652-
const binaryManager = new RazBinaryManager(context, outputChannel);
653-
await binaryManager.cleanupOldBinaries();
651+
// Clear old binary manager storage if it exists
652+
// Note: cleanupOldBinaries method may not exist in newer versions
653+
try {
654+
const binaryManager = new RazBinaryManager(context, outputChannel);
655+
if (typeof (binaryManager as any).cleanupOldBinaries === 'function') {
656+
await (binaryManager as any).cleanupOldBinaries();
657+
}
658+
} catch (e) {
659+
// Ignore if method doesn't exist
660+
}
654661

655662
// Clear migration flags to force re-check
656663
await context.globalState.update('raz.migrated.v0.2.1', undefined);

0 commit comments

Comments
 (0)