bsp_types/
client_capabilities.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Eq, Clone)]
4#[serde(rename_all = "camelCase")]
5pub struct ClientCapabilities {
6    /// The languages that this client supports.
7    /// The ID strings for each language is defined in the LSP.
8    /// The server must never respond with build targets for other
9    /// languages than those that appear in this list.
10    language_ids: Vec<String>,
11}
12
13impl ClientCapabilities {
14    pub fn new(language_ids: Vec<String>) -> Self {
15        Self { language_ids }
16    }
17
18    /// Set the bsp client capabilities's language ids.
19    pub fn set_language_ids(&mut self, language_ids: Vec<String>) {
20        self.language_ids = language_ids;
21    }
22
23    /// Get a reference to the bsp client capabilities's language ids.
24    pub fn language_ids(&self) -> &[String] {
25        self.language_ids.as_ref()
26    }
27
28    /// Get a mutable reference to the bsp client capabilities's language ids.
29    pub fn language_ids_mut(&mut self) -> &mut Vec<String> {
30        &mut self.language_ids
31    }
32}