Skip to content

Commit 1aa7883

Browse files
refactor(Common): Clean up and standardize DTO and provider definitions
- Removed commented-out re-exports in DTO module files to reduce clutter and improve clarity - Simplified `EstablishHostConnection` effect to single-line implementation - Standardized formatting in DTOs (e.g., `CompletionItemDTO`) and provider traits by placing comments above fields/parameters - Reorganized module exports in `LanguageFeature/DTO/mod.rs` for logical grouping - Updated parameter formatting in provider traits (`LanguageFeatureProviderRegistry`, `SourceControlManagementProvider`, `TreeViewProvider`, `WebViewProvider`) for consistency - Removed placeholder module comments from synchronization and testing components - Rebuilt `libCommon` artifacts to reflect source changes These changes enhance code maintainability and consistency across the `Common` crate, which defines Land's abstract core architecture. The cleanup aligns with our focus on declarative patterns by removing unnecessary comments and standardizing DTO/provider interfaces used by `Mountain` implementations and `Cocoon`'s Effect-TS services.
1 parent e0550e9 commit 1aa7883

File tree

16 files changed

+64
-80
lines changed

16 files changed

+64
-80
lines changed

Source/DTO/mod.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,3 @@
77
#![allow(non_snake_case, non_camel_case_types)]
88

99
pub mod WorkSpaceEditDTO;
10-
11-
// // Re-export shared DTOs
12-
// pub use self::WorkSpaceEditDTO::WorkSpaceEditDTO;
13-
14-
// // Re-export service-specific DTOs
15-
// pub use crate::Configuration::DTO::*;
16-
// pub use crate::FileSystem::DTO::*;
17-
// pub use crate::IPC::DTO::*;
18-
// pub use crate::LanguageFeature::DTO::*;
19-
// pub use crate::SourceControlManagement::DTO::*;
20-
// pub use crate::StatusBar::DTO::*;
21-
// pub use crate::TreeView::DTO::*;
22-
// pub use crate::UserInterface::DTO::*;
23-
// pub use crate::WebView::DTO::*;

Source/IPC/EstablishHostConnection.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,5 @@ use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError,
2626
/// An `ActionEffect` that resolves to `()` on success and requires the
2727
/// `IPCProvider` capability to be executed.
2828
pub fn EstablishHostConnection(SidecarIdentifier:String) -> ActionEffect<Arc<dyn IPCProvider>, CommonError, ()> {
29-
SendNotificationToSidecar(
30-
SidecarIdentifier,
31-
"$InitialHandshake".to_string(), // Use the conventional '$' prefix
32-
Value::Null,
33-
)
29+
SendNotificationToSidecar(SidecarIdentifier, "$InitialHandshake".to_string(), Value::Null)
3430
}

Source/LanguageFeature/DTO/CompletionItemDTO.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,21 @@ use serde_json::Value;
1111
#[serde(rename_all = "PascalCase")]
1212
pub struct CompletionItemDTO {
1313
/// The label of this completion item.
14-
pub Label:Value, // Can be string or a CompletionItemLabel object
14+
// Can be string or a CompletionItemLabel object
15+
pub Label: Value,
1516

1617
/// The kind of this completion item.
17-
pub Kind:u32, // Corresponds to vscode.CompletionItemKind enum
18+
// Corresponds to vscode.CompletionItemKind enum
19+
pub Kind: u32,
1820

1921
/// A human-readable string with additional information about this item.
2022
#[serde(skip_serializing_if = "Option::is_none")]
2123
pub Detail:Option<String>,
2224

2325
/// A human-readable string that represents a doc-comment.
2426
#[serde(skip_serializing_if = "Option::is_none")]
25-
pub Documentation:Option<Value>, // string or IMarkdownStringDTO
27+
// string or IMarkdownStringDTO
28+
pub Documentation: Option<Value>,
2629

2730
/// A string that should be used when comparing this item with other items.
2831
#[serde(skip_serializing_if = "Option::is_none")]
@@ -35,18 +38,22 @@ pub struct CompletionItemDTO {
3538
/// A string or snippet that should be inserted in a document when selecting
3639
/// this completion.
3740
#[serde(skip_serializing_if = "Option::is_none")]
38-
pub InsertText:Option<Value>, // string or SnippetString DTO
41+
// string or SnippetString DTO
42+
pub InsertText: Option<Value>,
3943

4044
/// A range of text that should be replaced by this completion item.
4145
#[serde(skip_serializing_if = "Option::is_none")]
42-
pub Range:Option<Value>, // RangeDTO or { inserting: RangeDTO, replacing: RangeDTO }
46+
// RangeDTO or { inserting: RangeDTO, replacing: RangeDTO }
47+
pub Range: Option<Value>,
4348

4449
/// An optional array of additional text edits that are applied when
4550
/// selecting this completion.
4651
#[serde(skip_serializing_if = "Option::is_none")]
47-
pub AdditionalTextEdits:Option<Vec<Value>>, // Vec<TextEditDTO>
52+
// Vec<TextEditDTO>
53+
pub AdditionalTextEdits: Option<Vec<Value>>,
4854

4955
/// A command that should be executed after inserting this completion.
5056
#[serde(skip_serializing_if = "Option::is_none")]
51-
pub Command:Option<Value>, // CommandDTO
57+
// CommandDTO
58+
pub Command: Option<Value>,
5259
}

Source/LanguageFeature/DTO/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
66
#![allow(non_snake_case, non_camel_case_types)]
77

8+
pub mod CompletionContextDTO;
9+
pub mod CompletionItemDTO;
10+
pub mod CompletionListDTO;
811
pub mod HoverResultDTO;
912
pub mod IMarkdownStringDTO;
13+
pub mod LocationDTO;
1014
pub mod PositionDTO;
1115
pub mod ProviderType;
1216
pub mod RangeDTO;
13-
pub mod CompletionContextDTO;
14-
pub mod CompletionItemDTO;
15-
pub mod CompletionListDTO;
16-
pub mod LocationDTO;
1717
pub mod TextEditDTO;
1818

1919
// pub use self::{

Source/LanguageFeature/LanguageFeatureProviderRegistry.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ pub trait LanguageFeatureProviderRegistry: Environment + Send + Sync {
7171
async fn ProvideCodeActions(
7272
&self,
7373
DocumentURI:Url,
74-
RangeOrSelectionDTO:Value, // Range DTO
75-
ContextDTO:Value, // CodeActionContextDTO
74+
// Range DTO
75+
RangeOrSelectionDTO:Value,
76+
// CodeActionContextDTO
77+
ContextDTO:Value,
7678
) -> Result<Option<Value /* CodeActionListDTO */>, CommonError>;
7779

7880
async fn ProvideCodeLenses(&self, DocumentURI:Url) -> Result<Option<Value /* CodeLensListDTO */>, CommonError>;
@@ -94,7 +96,8 @@ pub trait LanguageFeatureProviderRegistry: Environment + Send + Sync {
9496
async fn ProvideDocumentFormattingEdits(
9597
&self,
9698
DocumentURI:Url,
97-
OptionsDTO:Value, // FormattingOptions DTO
99+
// FormattingOptions DTO
100+
OptionsDTO:Value,
98101
) -> Result<Option<Vec<TextEditDTO>>, CommonError>;
99102

100103
async fn ProvideDocumentHighlights(
@@ -108,8 +111,10 @@ pub trait LanguageFeatureProviderRegistry: Environment + Send + Sync {
108111
async fn ProvideDocumentRangeFormattingEdits(
109112
&self,
110113
DocumentURI:Url,
111-
RangeDTO:Value, // Range DTO
112-
OptionsDTO:Value, // FormattingOptions DTO
114+
// Range DTO
115+
RangeDTO:Value,
116+
// FormattingOptions DTO
117+
OptionsDTO:Value,
113118
) -> Result<Option<Vec<TextEditDTO>>, CommonError>;
114119

115120
async fn ProvideHover(
@@ -122,7 +127,8 @@ pub trait LanguageFeatureProviderRegistry: Environment + Send + Sync {
122127
&self,
123128
DocumentURI:Url,
124129
PositionDTO:PositionDTO,
125-
ContextDTO:Value, // ReferenceContext DTO
130+
// ReferenceContext DTO
131+
ContextDTO:Value,
126132
) -> Result<Option<Vec<LocationDTO>>, CommonError>;
127133

128134
async fn PrepareRename(&self, DocumentURI:Url, PositionDTO:PositionDTO) -> Result<Option<Value>, CommonError>;

Source/LanguageFeature/ProvideCompletions.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ pub fn ProvideCompletions(
2424
) -> ActionEffect<Arc<dyn LanguageFeatureProviderRegistry>, CommonError, Option<CompletionListDTO>> {
2525
ActionEffect::New(Arc::new(move |Registry:Arc<dyn LanguageFeatureProviderRegistry>| {
2626
let URIClone = DocumentURI.clone();
27-
let PositionClone = PositionDTO; // PositionDTO is Copy
27+
// PositionDTO is Copy
28+
let PositionClone = PositionDTO;
2829
let ContextClone = ContextDTO.clone();
2930
let TokenClone = CancellationTokenValue.clone();
3031
Box::pin(async move {

Source/SourceControlManagement/DTO/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
#![allow(non_snake_case, non_camel_case_types)]
77

88
pub mod SourceControlCreateDTO;
9-
pub mod SourceControlUpdateDTO;
109
pub mod SourceControlGroupUpdateDTO;
1110
pub mod SourceControlInputBoxDTO;
1211
pub mod SourceControlManagementGroupDTO;
1312
pub mod SourceControlManagementProviderDTO;
1413
pub mod SourceControlManagementResourceDTO;
14+
pub mod SourceControlUpdateDTO;
1515

1616
// pub use self::{
1717
// SourceControlManagementGroupDTO::SourceControlManagementGroupDTO,

Source/SourceControlManagement/SourceControlManagementProvider.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ pub trait SourceControlManagementProvider: Environment + Send + Sync {
2929
/// A `Result` containing a unique handle (`u32`) for the new provider.
3030
async fn CreateSourceControl(
3131
&self,
32-
ProviderData:Value, // DTO: SourceControlCreateDTO
32+
// DTO: SourceControlCreateDTO
33+
ProviderData:Value,
3334
) -> Result<u32, CommonError>;
3435

3536
/// Disposes of an SCM provider, removing it and its groups from the UI.
@@ -49,7 +50,8 @@ pub trait SourceControlManagementProvider: Environment + Send + Sync {
4950
async fn UpdateSourceControl(
5051
&self,
5152
ProviderHandle:u32,
52-
UpdateData:Value, // DTO: SourceControlUpdateDTO
53+
// DTO: SourceControlUpdateDTO
54+
UpdateData:Value,
5355
) -> Result<(), CommonError>;
5456

5557
/// Updates the properties of an SCM resource group (e.g., "Changes").
@@ -63,7 +65,8 @@ pub trait SourceControlManagementProvider: Environment + Send + Sync {
6365
async fn UpdateSourceControlGroup(
6466
&self,
6567
ProviderHandle:u32,
66-
GroupData:Value, // DTO: SourceControlGroupUpdateDTO
68+
// DTO: SourceControlGroupUpdateDTO
69+
GroupData:Value,
6770
) -> Result<(), CommonError>;
6871

6972
/// Registers or updates the SCM input box for a provider.
@@ -75,6 +78,7 @@ pub trait SourceControlManagementProvider: Environment + Send + Sync {
7578
async fn RegisterInputBox(
7679
&self,
7780
ProviderHandle:u32,
78-
InputBoxData:Value, // DTO: SourceControlInputBoxDTO
81+
// DTO: SourceControlInputBoxDTO
82+
InputBoxData:Value,
7983
) -> Result<(), CommonError>;
8084
}

Source/Synchronization/mod.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,3 @@
88

99
// --- Trait Definition ---
1010
pub mod SynchronizationProvider;
11-
// pub use self::SynchronizationProvider::SynchronizationProvider;
12-
13-
// --- Data Transfer Objects ---
14-
// pub mod DTO; // Placeholder for future DTOs
15-
16-
// --- Effect Constructors ---
17-
// mod PullUserData; // Placeholder for future effects
18-
// mod PushUserData;

Source/Testing/mod.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,3 @@
88

99
// --- Trait Definition ---
1010
pub mod TestController;
11-
// pub use self::TestController::TestController;
12-
13-
// --- Data Transfer Objects ---
14-
// pub mod DTO; // Placeholder for future DTOs
15-
16-
// --- Effect Constructors ---
17-
// mod RegisterTestController; // Placeholder for future effects
18-
// mod RunTests;

0 commit comments

Comments
 (0)