1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! LSP timeout configuration constants
//!
//! Separated timeout values for different LSP lifecycle phases:
//! - Process startup (fast, system-level operation)
//! - Server initialization (slow, needs to build indexes)
//! - Individual requests (medium, per-call timeout)
use Duration;
/// Timeout for starting the LSP server process
///
/// This is a system-level operation that should complete quickly.
/// If the process fails to start within this time, it indicates
/// a fundamental problem (missing binary, permission denied, etc.)
pub const PROCESS_STARTUP_TIMEOUT: Duration = from_secs;
/// Timeout for initializing the LSP server
///
/// This includes building workspace indexes, loading dependencies,
/// and preparing the server for use. Large projects (especially Rust)
/// may need 60-120 seconds to fully initialize.
///
/// We set this to 120s to accommodate very large Rust projects.
/// If timeout occurs, the process continues running in background
/// and status will be updated when ready.
pub const SERVER_INIT_TIMEOUT: Duration = from_secs;
/// Timeout for individual LSP requests
///
/// Each request (hover, definition, references, etc.) has its own
/// timeout. This prevents slow requests from blocking the entire system.
pub const REQUEST_TIMEOUT: Duration = from_secs;
/// Legacy timeout constant (deprecated)
///
/// This was the original single timeout for entire LSP startup.
/// Now replaced by PROCESS_STARTUP_TIMEOUT + SERVER_INIT_TIMEOUT.
/// Kept for backward compatibility during migration.
pub const LSP_STARTUP_TIMEOUT_SECS: u64 = 5;
/// Legacy wait timeout (backward compatibility)
///
/// Maps to SERVER_INIT_TIMEOUT for backward compatibility.
/// Use SERVER_INIT_TIMEOUT directly in new code.
pub const LSP_WAIT_TIMEOUT_SECS: u64 = 120;