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}
10
11/// The settings for a particular language server.
12#[derive(Default, Debug, Serialize, Deserialize)]
13pub struct LspSettings {
14    /// The settings for the language server binary.
15    pub binary: Option<CommandSettings>,
16    /// The initialization options to pass to the language server.
17    pub initialization_options: Option<serde_json::Value>,
18    /// The settings to pass to language server.
19    pub settings: Option<serde_json::Value>,
20}
21
22/// The settings for a particular context server.
23#[derive(Default, Debug, Serialize, Deserialize, PartialEq, Eq)]
24pub struct ContextServerSettings {
25    /// The settings for the context server binary.
26    pub command: Option<CommandSettings>,
27    /// The settings to pass to the context server.
28    pub settings: Option<serde_json::Value>,
29}
30
31/// The settings for a command.
32#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
33pub struct CommandSettings {
34    /// The path to the command.
35    pub path: Option<String>,
36    /// The arguments to pass to the command.
37    pub arguments: Option<Vec<String>>,
38    /// The environment variables.
39    pub env: Option<HashMap<String, String>>,
40}