Skip to content

Commit dce740d

Browse files
refactor(Common): Enforce PascalCase naming convention across codebase
Align all trait method names, function names, and code examples with the PascalCase naming standard defined in CLAUDE.md. This includes: - Rename trait methods: `read_file` → `ReadFile`, `write_file` → `WriteFile`, `get_configuration` → `GetConfiguration`, `update_configuration` → `UpdateConfiguration`, `get_workspace_folders` → `UpdateWorkspaceFolders` - Rename effect constructors: `read_file_effect` → `ReadFile_effect`, `get_configuration_effect` → `GetConfiguration_effect` - Reformat struct field declarations to remove spaces before colons (consistent with Rust style) - Reorganize import statements to use grouped `super::{}` syntax - Update doc comments with proper line wrapping for readability - Fix code examples in DeepDive.md documentation to reflect new naming These are purely cosmetic refactoring changes that improve code consistency without altering any runtime behavior.
1 parent 985d8ae commit dce740d

34 files changed

Lines changed: 514 additions & 705 deletions

Documentation/GitHub/DeepDive.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,13 @@ graph LR
206206
// Service trait definition
207207
#[async_trait]
208208
pub trait FileSystemReader: Send + Sync {
209-
async fn read_file(&self, path: &PathBuf) -> Result<Vec<u8>, CommonError>;
209+
async fn ReadFile(&self, path: &PathBuf) -> Result<Vec<u8>, CommonError>;
210210
}
211211

212212
// Effect requiring the trait
213-
pub fn read_file_effect(path: PathBuf) -> ActionEffect<Arc<dyn FileSystemReader>, CommonError, Vec<u8>> {
213+
pub fn ReadFile_effect(path: PathBuf) -> ActionEffect<Arc<dyn FileSystemReader>, CommonError, Vec<u8>> {
214214
ActionEffect::new(move |fs: Arc<dyn FileSystemReader>| {
215-
Box::pin(async move { fs.read_file(&path).await })
215+
Box::pin(async move { fs.ReadFile(&path).await })
216216
})
217217
}
218218
```
@@ -333,7 +333,7 @@ sequenceDiagram
333333
#[async_trait]
334334
pub trait WorkspaceService: Send + Sync {
335335
async fn get_workspace_folders(&self) -> Result<Vec<WorkspaceFolder>, CommonError>;
336-
async fn update_workspace_folders(&self, folders: Vec<WorkspaceFolder>) -> Result<(), CommonError>;
336+
async fn UpdateWorkspaceFolders(&self, folders: Vec<WorkspaceFolder>) -> Result<(), CommonError>;
337337
}
338338
```
339339

@@ -368,15 +368,15 @@ pub struct WorkspaceFolderDTO {
368368
// VSCode file system service interface
369369
#[async_trait]
370370
pub trait FileSystemService: Send + Sync {
371-
async fn read_file(&self, uri: &str) -> Result<Vec<u8>, CommonError>;
372-
async fn write_file(&self, uri: &str, content: &[u8]) -> Result<(), CommonError>;
371+
async fn ReadFile(&self, uri: &str) -> Result<Vec<u8>, CommonError>;
372+
async fn WriteFile(&self, uri: &str, content: &[u8]) -> Result<(), CommonError>;
373373
async fn stat(&self, uri: &str) -> Result<FileStat, CommonError>;
374374
}
375375

376376
// File system effect constructors
377-
pub fn read_file_effect(uri: String) -> ActionEffect<Arc<dyn FileSystemService>, CommonError, Vec<u8>> {
377+
pub fn ReadFile_effect(uri: String) -> ActionEffect<Arc<dyn FileSystemService>, CommonError, Vec<u8>> {
378378
ActionEffect::new(move |fs: Arc<dyn FileSystemService>| {
379-
Box::pin(async move { fs.read_file(&uri).await })
379+
Box::pin(async move { fs.ReadFile(&uri).await })
380380
})
381381
}
382382
```
@@ -387,14 +387,14 @@ pub fn read_file_effect(uri: String) -> ActionEffect<Arc<dyn FileSystemService>,
387387
// VSCode configuration service interface
388388
#[async_trait]
389389
pub trait ConfigurationService: Send + Sync {
390-
async fn get_configuration(&self, section: Option<&str>) -> Result<Value, CommonError>;
391-
async fn update_configuration(&self, key: &str, value: Value) -> Result<(), CommonError>;
390+
async fn GetConfiguration(&self, section: Option<&str>) -> Result<Value, CommonError>;
391+
async fn UpdateConfiguration(&self, key: &str, value: Value) -> Result<(), CommonError>;
392392
}
393393

394394
// Configuration effect constructors
395-
pub fn get_configuration_effect(section: Option<String>) -> ActionEffect<Arc<dyn ConfigurationService>, CommonError, Value> {
395+
pub fn GetConfiguration_effect(section: Option<String>) -> ActionEffect<Arc<dyn ConfigurationService>, CommonError, Value> {
396396
ActionEffect::new(move |config: Arc<dyn ConfigurationService>| {
397-
Box::pin(async move { config.get_configuration(section.as_deref()).await })
397+
Box::pin(async move { config.GetConfiguration(section.as_deref()).await })
398398
})
399399
}
400400
```
@@ -527,12 +527,12 @@ use Common::Effect::ActionEffect;
527527
use std::sync::Arc;
528528

529529
// Advanced effect composition
530-
let complex_effect = FileSystem::read_file(path.clone())
531-
.and_then(|content| FileSystem::write_file(other_path, content))
530+
let complex_effect = FileSystem::ReadFile(path.clone())
531+
.and_then(|content| FileSystem::WriteFile(other_path, content))
532532
.map(|_| println!("File operation completed successfully"));
533533

534534
// Effect with custom error handling
535-
let resilient_effect = FileSystem::read_file(path)
535+
let resilient_effect = FileSystem::ReadFile(path)
536536
.recover_with(|error| {
537537
log::warn!("File read failed: {}", error);
538538
ActionEffect::pure(Vec::new()) // Fallback to empty content

Source/LanguageFeature/ProvideCallHierarchy.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! # ProvideCallHierarchy Effect
22
//!
3-
//! Defines the `ActionEffect` for requesting call hierarchy incoming calls from a language feature
4-
//! provider.
3+
//! Defines the `ActionEffect` for requesting call hierarchy incoming calls from
4+
//! a language feature provider.
55
66
use std::sync::Arc;
77

@@ -10,7 +10,8 @@ use serde_json::Value;
1010
use super::LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry;
1111
use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError};
1212

13-
/// Creates an effect that, when executed, will request call hierarchy incoming calls.
13+
/// Creates an effect that, when executed, will request call hierarchy incoming
14+
/// calls.
1415
pub fn ProvideCallHierarchy(
1516
ItemDTO:Value,
1617
) -> ActionEffect<Arc<dyn LanguageFeatureProviderRegistry>, CommonError, Option<Value>> {

Source/LanguageFeature/ProvideCodeActions.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! # ProvideCodeActions Effect
22
//!
3-
//! Defines the `ActionEffect` for requesting code actions from a language feature
4-
//! provider.
3+
//! Defines the `ActionEffect` for requesting code actions from a language
4+
//! feature provider.
55
66
use std::sync::Arc;
77

@@ -24,6 +24,10 @@ pub fn ProvideCodeActions(
2424
let RangeOrSelectionDTOClone = RangeOrSelectionDTO.clone();
2525
let ContextDTOClone = ContextDTO.clone();
2626

27-
Box::pin(async move { Registry.ProvideCodeActions(DocumentURIClone, RangeOrSelectionDTOClone, ContextDTOClone).await })
27+
Box::pin(async move {
28+
Registry
29+
.ProvideCodeActions(DocumentURIClone, RangeOrSelectionDTOClone, ContextDTOClone)
30+
.await
31+
})
2832
}))
2933
}

Source/LanguageFeature/ProvideCodeLenses.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! # ProvideCodeLenses Effect
22
//!
3-
//! Defines the `ActionEffect` for requesting code lenses from a language feature
4-
//! provider.
3+
//! Defines the `ActionEffect` for requesting code lenses from a language
4+
//! feature provider.
55
66
use std::sync::Arc;
77

Source/LanguageFeature/ProvideDefinition.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
//! # ProvideDefinition Effect
22
//!
3-
//! Defines the `ActionEffect` for requesting definition locations from a language feature
4-
//! provider.
3+
//! Defines the `ActionEffect` for requesting definition locations from a
4+
//! language feature provider.
55
66
use std::sync::Arc;
77

8-
use super::DTO::LocationDTO::LocationDTO;
9-
use super::DTO::PositionDTO::PositionDTO;
108
use url::Url;
119

12-
use super::LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry;
10+
use super::{
11+
DTO::{LocationDTO::LocationDTO, PositionDTO::PositionDTO},
12+
LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry,
13+
};
1314
use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError};
1415

1516
/// Creates an effect that, when executed, will request definition locations.

Source/LanguageFeature/ProvideDocumentFormatting.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
//! # ProvideDocumentFormatting Effect
22
//!
3-
//! Defines the `ActionEffect` for requesting document formatting edits from a language feature
4-
//! provider.
3+
//! Defines the `ActionEffect` for requesting document formatting edits from a
4+
//! language feature provider.
55
66
use std::sync::Arc;
77

88
use serde_json::Value;
9-
use super::DTO::TextEditDTO::TextEditDTO;
109
use url::Url;
1110

12-
use super::LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry;
11+
use super::{DTO::TextEditDTO::TextEditDTO, LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry};
1312
use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError};
1413

15-
/// Creates an effect that, when executed, will request document formatting edits.
14+
/// Creates an effect that, when executed, will request document formatting
15+
/// edits.
1616
pub fn ProvideDocumentFormatting(
1717
DocumentURI:Url,
1818

Source/LanguageFeature/ProvideDocumentHighlights.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
//! # ProvideDocumentHighlights Effect
22
//!
3-
//! Defines the `ActionEffect` for requesting document highlights from a language feature
4-
//! provider.
3+
//! Defines the `ActionEffect` for requesting document highlights from a
4+
//! language feature provider.
55
66
use std::sync::Arc;
77

88
use serde_json::Value;
9-
use super::DTO::PositionDTO::PositionDTO;
109
use url::Url;
1110

12-
use super::LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry;
11+
use super::{DTO::PositionDTO::PositionDTO, LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry};
1312
use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError};
1413

1514
/// Creates an effect that, when executed, will request document highlights.

Source/LanguageFeature/ProvideDocumentSymbols.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! # ProvideDocumentSymbols Effect
22
//!
3-
//! Defines the `ActionEffect` for requesting document symbols from a language feature
4-
//! provider.
3+
//! Defines the `ActionEffect` for requesting document symbols from a language
4+
//! feature provider.
55
66
use std::sync::Arc;
77

Source/LanguageFeature/ProvideFoldingRanges.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! # ProvideFoldingRanges Effect
22
//!
3-
//! Defines the `ActionEffect` for requesting folding ranges from a language feature
4-
//! provider.
3+
//! Defines the `ActionEffect` for requesting folding ranges from a language
4+
//! feature provider.
55
66
use std::sync::Arc;
77

Source/LanguageFeature/ProvideInlayHints.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! # ProvideInlayHints Effect
22
//!
3-
//! Defines the `ActionEffect` for requesting inlay hints from a language feature
4-
//! provider.
3+
//! Defines the `ActionEffect` for requesting inlay hints from a language
4+
//! feature provider.
55
66
use std::sync::Arc;
77

0 commit comments

Comments
 (0)