Skip to content

Commit

Permalink
fix(vscode): reload command (#2979)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jannchie committed Aug 13, 2023
1 parent b47b207 commit 2c92b9c
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions packages/vscode/src/index.ts
Expand Up @@ -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
}
Expand Down Expand Up @@ -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.')
Expand Down

0 comments on commit 2c92b9c

Please sign in to comment.