Skip to content

Cancel initial file search if it takes too long #1242

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

Merged
merged 3 commits into from
Mar 11, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Cancel initial file search if it takes too long
The presence of symlinks can cause ripgrep processes to spawn and run for a really long time on some systems and/or projects. We set an upper limit of 15s to search for files in a workspace before we cancell the process.
  • Loading branch information
thecrypticace committed Feb 27, 2025
commit 63ce8d92f7a9411d51810184cf527066893c8272
10 changes: 10 additions & 0 deletions packages/vscode-tailwindcss/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,16 @@ export async function activate(context: ExtensionContext) {
}

let source: CancellationTokenSource | null = new CancellationTokenSource()
source.token.onCancellationRequested(() => {
source?.dispose()
source = null
outputChannel.appendLine(
'Server was not started. Search for Tailwind CSS-related files was taking too long.',
)
})

// Cancel the search after roughly 15 seconds
setTimeout(() => source?.cancel(), 15_000)

if (!(await anyFolderNeedsLanguageServer(Workspace.workspaceFolders ?? [], source!.token))) {
source?.dispose()
Expand Down