Common/Configuration/ConfigurationInspector.rs
1//! # ConfigurationInspector Trait
2//!
3//! Defines the abstract service trait for inspecting the sources of
4//! configuration values.
5
6use async_trait::async_trait;
7
8use super::DTO::{ConfigurationOverridesDTO::ConfigurationOverridesDTO, InspectResultDataDTO::InspectResultDataDTO};
9use crate::{Environment::Environment::Environment, Error::CommonError::CommonError};
10
11/// An abstract service contract for an environment component that can inspect
12/// a configuration key to provide details about its value in all relevant
13/// scopes (e.g., default, user, workspace) and its final effective value.
14///
15/// This capability is used to power UIs like the "Settings" editor, which
16/// often shows where a particular setting is defined and allows the user to
17/// see inherited values.
18#[async_trait]
19pub trait ConfigurationInspector: Environment + Send + Sync {
20 /// Inspects a configuration key to get its value from all relevant scopes.
21 ///
22 /// # Parameters
23 ///
24 /// * `Key`: The dot-separated configuration key to inspect.
25 /// * `Overrides`: A DTO specifying scope overrides (e.g., for a specific
26 /// resource or language).
27 ///
28 /// # Returns
29 ///
30 /// A `Result` containing an `Option<InspectResultDataDTO>`, which holds
31 /// the detailed breakdown of the key's values across all scopes. Returns
32 /// `None` if the key is not found in any configuration source.
33 async fn InspectConfigurationValue(
34 &self,
35
36 Key:String,
37
38 Overrides:ConfigurationOverridesDTO,
39 ) -> Result<Option<InspectResultDataDTO>, CommonError>;
40}