Skip to content

Commit 0fc5697

Browse files
committed
Cleanup
1 parent c577f13 commit 0fc5697

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/vscode-tailwindcss/src/extension.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,11 @@ export async function activate(context: ExtensionContext) {
534534
}
535535
}
536536

537+
/**
538+
* Note that this method can fire *many* times even for documents that are
539+
* not in a visible editor. It's critical that this doesn't start any
540+
* expensive operations more than is necessary.
541+
*/
537542
async function didOpenTextDocument(document: TextDocument): Promise<void> {
538543
if (document.languageId === 'tailwindcss') {
539544
servers.css.boot(context, outputChannel)
@@ -544,8 +549,7 @@ export async function activate(context: ExtensionContext) {
544549
return
545550
}
546551

547-
let uri = document.uri
548-
let folder = Workspace.getWorkspaceFolder(uri)
552+
let folder = Workspace.getWorkspaceFolder(document.uri)
549553

550554
// Files outside a folder can't be handled. This might depend on the language.
551555
// Single file languages like JSON might handle files outside the workspace folders.
@@ -555,6 +559,7 @@ export async function activate(context: ExtensionContext) {
555559
}
556560

557561
context.subscriptions.push(Workspace.onDidOpenTextDocument(didOpenTextDocument))
562+
558563
Workspace.textDocuments.forEach(didOpenTextDocument)
559564
context.subscriptions.push(
560565
Workspace.onDidChangeWorkspaceFolders(async () => {

0 commit comments

Comments
 (0)