Skip to content

Commit a02bc92

Browse files
committed
update: 优化代码 (#568)
1 parent 48bd8a6 commit a02bc92

File tree

2 files changed

+5
-26
lines changed

2 files changed

+5
-26
lines changed

src/extension.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,11 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
5454

5555
context.subscriptions.push(
5656
vscode.commands.registerCommand('extension.background.uninstall', async () => {
57-
if (await background.uninstall()) {
58-
// 当且仅当成功删除样式时才会卸载扩展
59-
// 否则可能导致没有成功删掉样式时扩展就被卸载掉
60-
await vscode.commands.executeCommand('workbench.extensions.uninstallExtension', EXTENSION_ID);
61-
vsHelp.reload({
62-
message: l10n.t('Background extension has been uninstalled. See you next time!')
63-
});
64-
}
57+
await background.uninstall();
58+
await vscode.commands.executeCommand('workbench.extensions.uninstallExtension', EXTENSION_ID);
59+
vsHelp.reload({
60+
message: l10n.t('Background extension has been uninstalled. See you next time!')
61+
});
6562
})
6663
);
6764

src/utils/index.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ import sudo from '@vscode/sudo-prompt';
33
import { vsc } from './vsc';
44

55
export namespace _ {
6-
/**
7-
* if zh-CN
8-
*/
9-
export const isZHCN = /^zh/.test(vsc?.env.language || '');
10-
116
/**
127
* if desktop
138
*
@@ -17,19 +12,6 @@ export namespace _ {
1712
*/
1813
export const isDesktop = vsc?.env.appHost === 'desktop';
1914

20-
/**
21-
* 等待若干时间
22-
*
23-
* @export
24-
* @param {number} [delay=0]
25-
* @return {*}
26-
*/
27-
export function sleep(delay = 0) {
28-
return new Promise<void>(resolve => {
29-
setTimeout(resolve, delay);
30-
});
31-
}
32-
3315
/**
3416
* 提权运行
3517
*

0 commit comments

Comments
 (0)