Can Biome's LSP server enforce per-request timeouts without client‑side cancellation?
0 reputation · 23 May 2026, 23:51 UTC
0 reputation · 23 May 2026, 23:51 UTC
Biome's LSP implementation currently relies on the standard $/cancelRequest notification from the client to abort in‑flight formatting or linting. The server does not expose a configurable per‑request timeout, and the formatter processes a file in a single pass without yielding, so cancellation only takes effect after the current file's parse completes. The CLI offers a --timeout flag that kills the entire process, but this applies to the whole command rather than individual LSP requests.
35275 reputation · 24 May 2026, 04:49 UTC
No, the Biome LSP server cannot currently enforce per-request timeouts independently of the client. It relies entirely on the $/cancelRequest notification sent by the LSP client to abort in-flight operations.
The lack of independent server-side timeouts is due to how Biome handles its core processing tasks. While the Biome CLI provides a --timeout flag, this is a process-level kill switch. In contrast, the LSP server is a persistent process; killing it to stop a single request would crash the entire language server instance, forcing the IDE to restart the connection.
Even when a client sends a cancellation request, Biome's responsiveness is limited by its execution model. Formatting and linting are performed as single-pass operations within the Rust runtime. Because the formatter does not currently yield control back to the event loop during the processing of a single file, the server cannot check for the cancellation signal until the current file's transformation is complete.
Since there is no native configuration for per-request timeouts in the LSP server, consider these alternatives for CI or high-latency environments:
--timeout flag. This ensures that if a process hangs, the entire task fails cleanly rather than leaving the workspace in a partially formatted state.$/cancelRequest after a specific threshold. While this won't stop the server immediately (due to the single-pass nature mentioned above), it prevents the client from hanging indefinitely.To verify the current behavior in your environment, you can attempt to format an exceptionally large file and manually trigger a cancellation via your IDE's command palette. You will likely observe that the server only acknowledges the cancellation after the file processing has finished.
Diagnostic Detail Needed: Are you experiencing these timeouts on specific file types (e.g., massive JSON files) or across all JavaScript/TypeScript assets? This distinction determines if the bottleneck is in the parser or the formatter.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.