Skip to content

Commit 8d02006

Browse files
committed
Only run workspace analysis once
1 parent 0e51b10 commit 8d02006

File tree

1 file changed

+5
-1
lines changed
  • packages/vscode-tailwindcss/src

1 file changed

+5
-1
lines changed

packages/vscode-tailwindcss/src/api.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ interface ApiOptions {
77
}
88

99
export async function createApi({ context, outputChannel }: ApiOptions) {
10+
let folderAnalysis: Promise<boolean> | null = null
11+
1012
async function workspaceNeedsLanguageServer() {
13+
if (folderAnalysis) return folderAnalysis
14+
1115
let source: CancellationTokenSource | null = new CancellationTokenSource()
1216
source.token.onCancellationRequested(() => {
1317
source?.dispose()
@@ -22,7 +26,7 @@ export async function createApi({ context, outputChannel }: ApiOptions) {
2226
setTimeout(() => source?.cancel(), 15_000)
2327
context.subscriptions.push(source)
2428

25-
folderAnalysis = anyWorkspaceFoldersNeedServer({
29+
folderAnalysis ??= anyWorkspaceFoldersNeedServer({
2630
token: source.token,
2731
folders: workspace.workspaceFolders ?? [],
2832
})

0 commit comments

Comments
 (0)