Skip to content

Commit

Permalink
chore(vscode): insider link status
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Mar 20, 2024
1 parent 60b50d1 commit e9756b8
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions extensions/vscode/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,36 @@ async function doActivate(context: vscode.ExtensionContext, createLc: CreateLang
hybridModeStatus.severity = vscode.LanguageStatusSeverity.Warning;
}

if (!context.extension.packageJSON.version.includes('-insider')) {
let s = 10;
const upgradeStatus = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, -10000);
const interval = setInterval(() => {
s--;
upgradeStatus.text = `✨ Upgrade Vue - Official (${s})`;
if (s <= 0) {
upgradeStatus.dispose();
clearInterval(interval);

const upgradeStatus2 = vscode.languages.createLanguageStatusItem('vue-upgrade', 'vue');
upgradeStatus2.text = '✨ Upgrade Vue - Official';
upgradeStatus2.severity = vscode.LanguageStatusSeverity.Warning;
upgradeStatus2.command = {
title: 'Open Link',
command: 'vscode.open',
arguments: ['https://github.com/vuejs/language-tools/discussions/4127'],
};
}
}, 1000);
upgradeStatus.text = `✨ Upgrade Vue - Official (${s})`;
upgradeStatus.color = '#ebb549';
upgradeStatus.command = {
title: 'Open Link',
command: 'vscode.open',
arguments: ['https://github.com/vuejs/language-tools/discussions/4127'],
};
upgradeStatus.show();
}

async function requestReloadVscode(msg: string) {
const reload = await vscode.window.showInformationMessage(msg, 'Reload Window');
if (reload === undefined) return; // cancel
Expand Down

4 comments on commit e9756b8

@luc122c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reconsider putting this ad in the main status bar. I don't particularly mind it in the Vue section, but it takes up a lot of room in the statusbar and then causes a big layout shift when it disappears.

@johnsoncodehk
Copy link
Member Author

@johnsoncodehk johnsoncodehk commented on e9756b8 Mar 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next version I'll try to make it disappear in a way that doesn't affect the layout, and shorten the text, thanks.

@johnsoncodehk
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 3ee5c55.

Now the layout will not be changed when the status item disappears, and the prompt will be displayed only once a day instead of every time when vscode is reloaded. .

@luc122c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, much appreciated.

Please sign in to comment.