TypeScript Language Service concurrency limit during bulk refactoring operations
0 reputation · 21 Aug 2021, 23:50 UTC
0 reputation · 21 Aug 2021, 23:50 UTC
WebStorm delegates TypeScript diagnostics to the TypeScript Language Service (TSServer) when Use TypeScript Language Service is enabled. During multi-file refactorings that touch hundreds of files, the IDE spawns unbounded compilation requests to the TSServer process, which can saturate CPU and block the UI thread for extended periods.
Recompile on changes but does not specify a throttle, queue depth, or back-pressure mechanism.idea.properties setting that caps concurrent TSServer requests or introduces a request queue?Recompile on changes behavior be tuned to batch or debounce file-change notifications before they reach TSServer?35775 reputation · 22 Aug 2021, 09:33 UTC
When WebStorm’s TypeScript Language Service processes bulk refactorings that touch hundreds of files, the IDE issues compilation requests to the TSServer process without a documented upper bound on concurrency. This can saturate CPU and block the UI thread for extended periods.
\ntypescript.service.maxConcurrentRequests or typescript.service.requestQueueSize via Help > Find Action > Registry, and idea.properties entries like typescript.service.throttle.ms. These are neither guaranteed stable across releases nor officially supported; they may be ignored or removed without notice.Languages & Frameworks > TypeScript offer only two modes for Recompile on changes: On save and On change. No debounce interval, batch size, or throttle parameter appears in the UI or documented properties.On save reduces request frequency but does not debounce individual change events. For true debatching, the only supported approaches are temporarily disabling the TypeScript language service or configuring external file watchers to exclude generated directories.ps aux | grep tsserver) and IDE logs (Help > Show Log) during a multi‑file rename. Observe request rate and CPU usage without a built‑in pause mechanism.Based on current knowledge, no documented configuration caps concurrent TSServer requests or debounces file‑change notifications. Workarounds such as disabling the language service or excluding directories from type checking may reduce CPU contention at the cost of incremental diagnostic benefits.
\nIf you are testing undocumented registry or idea.properties entries, please confirm your WebStorm or IntelliJ IDE version; behavior may vary across releases.
Use comments to ask for clarification. Post a solution as an answer.
35,775 reputation · 22 Aug 2021, 03:27 UTC
The TSServer protocol itself does not expose flow-control or backpressure mechanisms—only request IDs and sequence numbers for correlation. This means WebStorm cannot negotiate rate limits with the server; any throttling must be implemented client-side. The most viable approach is to debounce file-change notifications before batching them into a single compilation request, rather than relying on undocumented settings.
WebStorm could introduce a configurable debounce window (e.g., 300–500ms) that coalesces rapid file edits during bulk refactors. This would align with how other IDEs handle language service overload. Until such a feature exists, the only reliable mitigation is disabling Use TypeScript Language Service during large refactorings and re-enabling it afterward.