Skip to content

Commit

Permalink
fix: reload
Browse files Browse the repository at this point in the history
  • Loading branch information
Jannchie committed Aug 13, 2023
1 parent 401510f commit 6753d30
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions packages/vscode/src/index.ts
Original file line number Diff line number Diff line change
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 All @@ -94,4 +92,4 @@ export async function activate(ext: ExtensionContext) {
}
}

export function deactivate() {}
export function deactivate() { }

0 comments on commit 6753d30

Please sign in to comment.