Skip to main content

LSP_EVENT_QUEUE_CAPACITY

Constant LSP_EVENT_QUEUE_CAPACITY 

Source
pub const LSP_EVENT_QUEUE_CAPACITY: usize = 4_096;
Expand description

Recommended capacity for the LspEvent channel.

The channel has to be bounded: it is fed by a language server this application does not control, and rust-analyzer on a large workspace emits a great deal. An unbounded queue turns that into unbounded memory whenever the host drains more slowly than the server produces.

Sized well above what a host draining on a timer can fall behind by, so the bound never bites in normal use – draining MAX_LSP_EVENTS_PER_TICK-sized batches at 60 Hz clears far more than this per second. Its job is to put a ceiling on a pathological server, not to shape ordinary traffic.