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
47
48
//! LSP configuration — shared between core and TUI.
//!
//! M3 also moved the diagnostic rendering data types into [`diagnostics`]
//! so the future core-side Engine struct can hold
//! `Vec<DiagnosticBlock>` and call `LspHost::diagnostics_for` without a
//! tui dependency. The tui crate re-exports both from `tui::lsp`.
pub mod diagnostics;
pub use diagnostics::{Diagnostic, DiagnosticBlock, Severity, render_blocks};
use std::collections::HashMap;
use serde::Deserialize;
/// `[lsp]` config schema. Mirrors the TOML keys documented in
/// `config.example.toml`. Unknown keys are ignored.
#[derive(Debug, Clone, Deserialize, PartialEq, Eq)]
#[serde(default)]
pub struct LspConfig {
/// Master switch. When `false`, the manager skips every operation and
/// returns an empty diagnostics list.
pub enabled: bool,
/// Maximum time in milliseconds to wait for the LSP server to publish
/// diagnostics after a `didOpen`/`didChange`. Default 5000 ms.
pub poll_after_edit_ms: u64,
/// Maximum diagnostics to keep per file. Excess items are dropped after
/// sorting by severity. Default 20.
pub max_diagnostics_per_file: usize,
/// When `true`, warnings (severity 2) are kept in the output. When
/// `false` (default), only errors (severity 1) are surfaced.
pub include_warnings: bool,
/// Optional override for the `Language -> (cmd, args)` table. Keys use
/// `Language::as_key` (e.g. `"rust"`).
pub servers: HashMap<String, Vec<String>>,
}
impl Default for LspConfig {
fn default() -> Self {
Self {
enabled: true,
poll_after_edit_ms: 5_000,
max_diagnostics_per_file: 20,
include_warnings: false,
servers: HashMap::new(),
}
}
}