Skip to content

Commit d44b014

Browse files
committed
Cancel remaining workspace searches once we know a server is needed
1 parent 4e31ae1 commit d44b014

File tree

1 file changed

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

1 file changed

+4
-1
lines changed

packages/vscode-tailwindcss/src/api.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ export async function createApi({ context, outputChannel }: ApiOptions) {
1111

1212
async function workspaceNeedsLanguageServer() {
1313
if (folderAnalysis) return folderAnalysis
14+
let found = false
1415

1516
let source: CancellationTokenSource | null = new CancellationTokenSource()
1617
source.token.onCancellationRequested(() => {
1718
source?.dispose()
1819
source = null
20+
if (found) return
1921

2022
outputChannel.appendLine(
2123
'Server was not started. Search for Tailwind CSS-related files was taking too long.',
@@ -32,7 +34,8 @@ export async function createApi({ context, outputChannel }: ApiOptions) {
3234
})
3335

3436
let result = await folderAnalysis
35-
source?.dispose()
37+
found = true
38+
source?.cancel()
3639
return result
3740
}
3841

0 commit comments

Comments
 (0)