diff --git a/package.json b/package.json index ebce756..d8eddf0 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "@antfu/eslint-config": "^0.38.4", "@types/node": "^18.15.11", "@types/vscode": "^1.77.0", - "@vscode-use/utils": "^0.0.36", + "@vscode-use/utils": "^0.0.82", "bumpp": "^9.1.0", "eslint": "^8.37.0", "esno": "^0.16.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b831e20..775f4f4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,8 +18,8 @@ importers: specifier: ^1.77.0 version: 1.77.0 '@vscode-use/utils': - specifier: ^0.0.36 - version: 0.0.36 + specifier: ^0.0.82 + version: 0.0.82 bumpp: specifier: ^9.1.0 version: 9.1.0 @@ -687,8 +687,8 @@ packages: pretty-format: 27.5.1 dev: true - /@vscode-use/utils@0.0.36: - resolution: {integrity: sha512-NNHWF1wkN+v+Voe3DWdqoAQIv5v3LhLKPnGIk+evDYpoPgmUtNwSCLECsCvU2Jw+1a4u3v8pz+6vG9pl7/pOkw==} + /@vscode-use/utils@0.0.82: + resolution: {integrity: sha512-qyMCBGTxz2BkFrmsvuWCb0sWfoW4oG3VjK8Yh065o5ZsZMbZZAu5Md4kJ1jKtZwLJzDhYDbDbdYCw9ChVoxm4w==} engines: {vscode: ^1.77.0} dev: true diff --git a/src/index.ts b/src/index.ts index 6b4fd7b..4b53cbe 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,13 +3,20 @@ import { rimraf } from 'rimraf' import type { ExtensionContext, Uri } from 'vscode' export function activate(context: ExtensionContext) { + let cacheMap: Uri[] = [] context.subscriptions.push( registerCommand('fastEmpty.delete', (current, selections: Uri[]) => { const start = Date.now() + if (cacheMap.includes(current)) { + message.warn(`${current} 正在删除中,请不要重复删除`) + return + } rimraf(selections.map(item => item.fsPath)).then((isSuccess) => { message.info(isSuccess ? `删除成功 🎉 (${(Date.now() - start) / 1000}s)` : '删除失败 ❌') + cacheMap = cacheMap.filter(cache => !selections.includes(cache)) }).catch((err) => { message.error(`删除失败 ❌ ${err}`) + cacheMap = cacheMap.filter(cache => !selections.includes(cache)) }) }), )