Skip to content

Commit 3b12952

Browse files
1 parent 40b1917 commit 3b12952

File tree

133 files changed

+621
-28
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+621
-28
lines changed

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ _returns a description of that effect_.
8383

8484
```rust
8585
async fn read_my_file(fs: &impl FileSystem) -> Result<Vec<u8>, Error> {
86-
fs.read("/path/to/file").await // The side effect happens here.
86+
// The side effect happens here.
87+
fs.read("/path/to/file").await
8788
}
8889
```
8990

@@ -197,23 +198,27 @@ follows:
197198
concrete implementation for a `Common` trait.
198199

199200
```rust
200-
// In Mountain/Source/Environment/FileSystemProvider.rs
201+
// In Mountain/Source/Environment/FileSystemProvider.rs
202+
201203
use Common::FileSystem::{FileSystemReader, FileSystemWriter};
202204

203205
#[async_trait]
204206
impl FileSystemReader for MountainEnvironment {
205207
async fn ReadFile(&self, Path: &PathBuf) -> Result<Vec<u8>, CommonError> {
206-
// ... actual `tokio::fs` call ...
208+
// ... actual `tokio::fs` call ...
209+
207210
}
208-
// ...
211+
// ...
212+
209213
}
210214
```
211215

212216
2. **Create and Execute an Effect:** In business logic, create and run an
213217
effect.
214218

215219
```rust
216-
// In a Mountain service or command
220+
// In a Mountain service or command
221+
217222
use Common::FileSystem;
218223
use Common::Effect::ApplicationRunTime;
219224

Source/Command/ExecuteCommand.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError}
1919
/// # Parameters
2020
///
2121
/// * `CommandIdentifier`: The unique ID of the command to execute (e.g.,
22+
2223
/// "FileSystem.ReadFile").
2324
/// * `Argument`: A `serde_json::Value` containing the arguments for the
2425
/// command.
@@ -30,11 +31,14 @@ use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError}
3031
/// during execution.
3132
pub fn ExecuteCommand(
3233
CommandIdentifier:String,
34+
3335
Argument:Value,
3436
) -> ActionEffect<Arc<dyn CommandExecutor>, CommonError, Value> {
3537
ActionEffect::New(Arc::new(move |Executor:Arc<dyn CommandExecutor>| {
3638
let CommandIdentifierClone = CommandIdentifier.clone();
39+
3740
let ArgumentClone = Argument.clone();
41+
3842
Box::pin(async move { Executor.ExecuteCommand(CommandIdentifierClone, ArgumentClone).await })
3943
}))
4044
}

Source/Command/RegisterCommand.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,22 @@ use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError}
2121
/// * `SidecarIdentifier`: The unique ID of the sidecar where the command logic
2222
/// resides.
2323
/// * `CommandIdentifier`: The unique ID of the command itself (e.g.,
24+
2425
/// "MyExtension.DoSomething").
2526
///
2627
/// # Returns
2728
///
2829
/// An `ActionEffect` that resolves to `()` on success.
2930
pub fn RegisterCommand(
3031
SidecarIdentifier:String,
32+
3133
CommandIdentifier:String,
3234
) -> ActionEffect<Arc<dyn CommandExecutor>, CommonError, ()> {
3335
ActionEffect::New(Arc::new(move |Executor:Arc<dyn CommandExecutor>| {
3436
let SidecarIdentifierClone = SidecarIdentifier.clone();
37+
3538
let CommandIdentifierClone = CommandIdentifier.clone();
39+
3640
Box::pin(async move { Executor.RegisterCommand(SidecarIdentifierClone, CommandIdentifierClone).await })
3741
}))
3842
}

Source/Command/UnregisterCommand.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,14 @@ use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError}
2525
/// An `ActionEffect` that resolves to `()` on success.
2626
pub fn UnregisterCommand(
2727
SidecarIdentifier:String,
28+
2829
CommandIdentifier:String,
2930
) -> ActionEffect<Arc<dyn CommandExecutor>, CommonError, ()> {
3031
ActionEffect::New(Arc::new(move |Executor:Arc<dyn CommandExecutor>| {
3132
let SidecarIdentifierClone = SidecarIdentifier.clone();
33+
3234
let CommandIdentifierClone = CommandIdentifier.clone();
35+
3336
Box::pin(async move { Executor.UnregisterCommand(SidecarIdentifierClone, CommandIdentifierClone).await })
3437
}))
3538
}

Source/Command/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ pub mod CommandExecutor;
1212

1313
// --- Effect Constructors ---
1414
pub mod ExecuteCommand;
15+
1516
pub mod GetAllCommands;
17+
1618
pub mod RegisterCommand;
19+
1720
pub mod UnregisterCommand;

Source/Configuration/ConfigurationInspector.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ pub trait ConfigurationInspector: Environment + Send + Sync {
3232
/// `None` if the key is not found in any configuration source.
3333
async fn InspectConfigurationValue(
3434
&self,
35+
3536
Key:String,
37+
3638
Overrides:ConfigurationOverridesDTO,
3739
) -> Result<Option<InspectResultDataDTO>, CommonError>;
3840
}

Source/Configuration/ConfigurationProvider.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ pub trait ConfigurationProvider: Environment + Send + Sync {
3737
/// `serde_json::Value`.
3838
async fn GetConfigurationValue(
3939
&self,
40+
4041
Section:Option<String>,
42+
4143
Overrides:ConfigurationOverridesDTO,
4244
) -> Result<Value, CommonError>;
4345

@@ -54,10 +56,15 @@ pub trait ConfigurationProvider: Environment + Send + Sync {
5456
/// settings.
5557
async fn UpdateConfigurationValue(
5658
&self,
59+
5760
Key:String,
61+
5862
ValueToSet:Value,
63+
5964
Target:ConfigurationTarget,
65+
6066
Overrides:ConfigurationOverridesDTO,
67+
6168
ScopeToLanguage:Option<bool>,
6269
) -> Result<(), CommonError>;
6370
}

Source/Configuration/DTO/ConfigurationScope.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,23 @@ pub enum ConfigurationScope {
1616
/// Application-specific configuration, which can only be configured in user
1717
/// settings.
1818
Application = 1,
19+
1920
/// Machine-specific configuration, which can only be configured in user
2021
/// settings and is not synced.
2122
Machine = 2,
23+
2224
/// Window-specific configuration, which can be configured in user or
2325
/// workspace settings.
2426
Window = 3,
27+
2528
/// Resource-specific configuration, which can be configured in all settings
2629
/// levels (user, workspace, folder).
2730
Resource = 4,
31+
2832
/// Language-specific configuration, which can be configured in all settings
2933
/// levels and can be overridden on a per-language basis.
3034
LanguageDefined = 5,
35+
3136
/// Machine-specific configuration that can be overridden by workspace
3237
/// settings.
3338
MachineOverridable = 6,

Source/Configuration/DTO/ConfigurationTarget.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,22 @@ use serde::{Deserialize, Serialize};
1515
pub enum ConfigurationTarget {
1616
/// Target the user settings file for the local machine.
1717
UserLocal = 1,
18+
1819
/// Target the user settings, potentially synced across machines.
1920
User = 2,
21+
2022
/// Target the workspace settings file (e.g., `.vscode/settings.json`).
2123
WorkSpace = 3,
24+
2225
/// Target a specific folder's settings in a multi-root workspace.
2326
WorkSpaceFolder = 4,
27+
2428
/// Target the default values (typically a read-only operation).
2529
Default = 5,
30+
2631
/// Target the in-memory configuration for the current session only.
2732
Memory = 6,
33+
2834
/// Target the policy-enforced configuration (read-only).
2935
Policy = 7,
3036
}

Source/Configuration/DTO/InspectResultDataDTO.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,46 @@ use serde_json::Value;
1717
pub struct InspectResultDataDTO {
1818
/// The value from the default configuration.
1919
pub DefaultValue:Option<Value>,
20+
2021
/// The value from the user (global) settings.
2122
pub UserValue:Option<Value>,
23+
2224
/// The value from the local (un-synced) user settings.
2325
pub UserLocalValue:Option<Value>,
26+
2427
/// The value from the remote user settings (if applicable).
2528
pub UserRemoteValue:Option<Value>,
29+
2630
/// The value from the workspace settings.
2731
pub WorkSpaceValue:Option<Value>,
32+
2833
/// The value from a specific workspace folder's settings.
2934
pub WorkSpaceFolderValue:Option<Value>,
35+
3036
/// The value from the in-memory configuration.
3137
pub MemoryValue:Option<Value>,
38+
3239
/// The value from the policy-enforced configuration.
3340
pub PolicyValue:Option<Value>,
41+
3442
/// The final, effective value after all scopes have been merged.
3543
pub EffectiveValue:Option<Value>,
3644

3745
// --- Language-Specific Overrides ---
3846
pub DefaultLanguageValue:Option<Value>,
47+
3948
pub UserLanguageValue:Option<Value>,
49+
4050
pub UserLocalLanguageValue:Option<Value>,
51+
4152
pub UserRemoteLanguageValue:Option<Value>,
53+
4254
pub WorkSpaceLanguageValue:Option<Value>,
55+
4356
pub WorkSpaceFolderLanguageValue:Option<Value>,
57+
4458
pub MemoryLanguageValue:Option<Value>,
59+
4560
pub PolicyLanguageValue:Option<Value>,
4661

4762
/// A list of language identifiers for which language-specific values were

0 commit comments

Comments
 (0)