From 2c92b9c1c6fbf3b8bedb690ccecf0cc55d52bffc Mon Sep 17 00:00:00 2001 From: Jianqi Pan Date: Sun, 13 Aug 2023 23:44:58 +0900 Subject: [PATCH] fix(vscode): reload command (#2979) --- packages/vscode/src/index.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/vscode/src/index.ts b/packages/vscode/src/index.ts index 79beaccc82..ca43437b71 100644 --- a/packages/vscode/src/index.ts +++ b/packages/vscode/src/index.ts @@ -16,12 +16,11 @@ async function registerRoot(ext: ExtensionContext, status: StatusBarItem, cwd: s const hasConfig = await contextLoader.loadContextInDirectory(cwd) // TODO: improve this to re-enable after configuration created - if (!hasConfig) - throw new Error(`➖ No config found in ${cwd}`) - - registerAutoComplete(cwd, contextLoader, ext) - registerAnnotations(cwd, contextLoader, status, ext) - registerSelectionStyle(cwd, contextLoader) + if (hasConfig) { + registerAutoComplete(cwd, contextLoader, ext) + registerAnnotations(cwd, contextLoader, status, ext) + registerSelectionStyle(cwd, contextLoader) + } return contextLoader } @@ -79,10 +78,9 @@ export async function activate(ext: ExtensionContext) { : projectPath try { - const contextLoader = await registerRoot(ext, status, cwd) - ext.subscriptions.push( commands.registerCommand('unocss.reload', async () => { + const contextLoader = await registerRoot(ext, status, cwd) log.appendLine('🔁 Reloading...') await contextLoader.reload() log.appendLine('✅ Reloaded.')