Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vscode): reload command #2979

Merged
merged 1 commit into from
Aug 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 6 additions & 8 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 Down