settings.rs

 1use serde::{Deserialize, Serialize};
 2use std::{collections::HashMap, num::NonZeroU32};
 3
 4/// The settings for a particular language.
 5#[derive(Debug, Serialize, Deserialize)]
 6pub struct LanguageSettings {
 7    /// How many columns a tab should occupy.
 8    pub tab_size: NonZeroU32,
 9    /// The preferred line length (column at which to wrap).
10    pub preferred_line_length: u32,
11}
12
13/// The settings for a particular language server.
14#[derive(Default, Debug, Serialize, Deserialize)]
15pub struct LspSettings {
16    /// The settings for the language server binary.
17    pub binary: Option<CommandSettings>,
18    /// The initialization options to pass to the language server.
19    pub initialization_options: Option<serde_json::Value>,
20    /// The settings to pass to language server.
21    pub settings: Option<serde_json::Value>,
22}
23
24/// The settings for a particular context server.
25#[derive(Default, Debug, Serialize, Deserialize, PartialEq, Eq)]
26pub struct ContextServerSettings {
27    /// The settings for the context server binary.
28    pub command: Option<CommandSettings>,
29    /// The settings to pass to the context server.
30    pub settings: Option<serde_json::Value>,
31}
32
33/// The settings for a command.
34#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
35pub struct CommandSettings {
36    /// The path to the command.
37    pub path: Option<String>,
38    /// The arguments to pass to the command.
39    pub arguments: Option<Vec<String>>,
40    /// The environment variables.
41    pub env: Option<HashMap<String, String>>,
42}