Skip to content

Commit 6202e70

Browse files
refactor(Mountain): Update import paths and function calls to match finalized module structure
This commit refactors import statements and function invocations across the Mountain backend to align with the finalized architecture: - Updated all trait implementations (e.g., `CommandProvider`, `DocumentProvider`) to use explicit nested module paths matching the `Common` crate's structure - Replaced `get_window()` with `get_webview_window()` for Tauri window access - Changed state access to use `try_state()` for safer error handling - Standardized function calls to use full path syntax (e.g., `Vine::Server::Initialize::Initialize()`) - Fixed Cocoon initialization call in main application flow These changes ensure Mountain properly implements the abstract traits defined in `Common` using the correct module paths and function signatures. The refactoring maintains architectural consistency across the Land project while resolving compilation issues from recent restructuring. No functionality changes were made - this purely aligns Mountain with the finalized module organization.
1 parent c1dcd82 commit 6202e70

21 files changed

Lines changed: 67 additions & 53 deletions

Source/Binary.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010

1111
use std::sync::Arc;
1212

13-
use Echo::Scheduler::SchedulerBuilder;
13+
use Echo::Scheduler::SchedulerBuilder::SchedulerBuilder;
1414
use log::{error, info};
1515
use tauri::{Manager, RunEvent};
1616

1717
use crate::{
1818
ApplicationState::ApplicationState::ApplicationState,
19-
Environment::MountainEnvironment,
20-
ProcessManagement, // Placeholder for future logic
19+
Environment::MountainEnvironment::MountainEnvironment,
20+
ProcessManagement::CocoonManagement::InitializeCocoon, // Placeholder for future logic
2121
RunTime::ApplicationRunTime::ApplicationRunTime,
2222
Vine,
2323
};
@@ -78,8 +78,8 @@ pub async fn main() {
7878
// PostSetupApplicationHandle, &ApplicationState).await; ApplicationState.
7979
// ScanExtensions(&PostSetupApplicationHandle).await;
8080

81-
Vine::Server::Initialize(PostSetupApplicationHandle.clone(), "[::1]:50051".to_string());
82-
ProcessManagement::InitializeCocoon(&PostSetupApplicationHandle).await;
81+
Vine::Server::Initialize::Initialize(PostSetupApplicationHandle.clone(), "[::1]:50051".to_string());
82+
InitializeCocoon(&PostSetupApplicationHandle).await;
8383

8484
info!("[SetupTask] Post-setup initializations complete.");
8585
});

Source/Environment/CommandProvider.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,20 @@
55
//! dispatching command execution to either native Rust handlers or proxied
66
//! sidecar handlers.
77
8-
use std::{collections::HashMap, future::Future, pin::Pin, sync::Arc};
8+
use std::{future::Future, pin::Pin, sync::Arc};
99

10-
use Common::{Command::CommandExecutor, Error::CommonError, IPC::DTO::ProxyTarget};
10+
use Common::{
11+
Command::CommandExecutor::CommandExecutor,
12+
Error::CommonError::CommonError,
13+
IPC::DTO::ProxyTarget::ProxyTarget,
14+
};
1115
use async_trait::async_trait;
1216
use log::{debug, error, info};
1317
use serde_json::{Value, json};
14-
use tauri::{Manager, Runtime, Window};
18+
use tauri::{AppHandle, Manager, Runtime, WebviewWindow};
1519

1620
use super::MountainEnvironment::MountainEnvironment;
17-
use crate::{ApplicationState::ApplicationState::ApplicationState, RunTime::ApplicationRunTime, Vine::Client};
21+
use crate::{RunTime::ApplicationRunTime::ApplicationRunTime, Vine::Client};
1822

1923
/// An enum representing the different ways a command can be handled.
2024
#[derive(Clone)]
@@ -23,7 +27,7 @@ pub enum CommandHandler<R:Runtime + 'static> {
2327
Native(
2428
fn(
2529
AppHandle<R>,
26-
Window<R>,
30+
WebviewWindow<R>,
2731
Arc<ApplicationRunTime>,
2832
Value,
2933
) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send>>,
@@ -49,7 +53,7 @@ impl CommandExecutor for MountainEnvironment {
4953
Some(CommandHandler::Native(Function)) => {
5054
debug!("[CommandProvider] Executing NATIVE command '{}'.", CommandIdentifier);
5155
let RunTime:Arc<ApplicationRunTime> = self.ApplicationHandle.state().inner().clone();
52-
let MainWindow = self.ApplicationHandle.get_window("main").ok_or_else(|| {
56+
let MainWindow = self.ApplicationHandle.get_webview_window("main").ok_or_else(|| {
5357
CommonError::UserInterfaceInteraction {
5458
Reason:"Main window not found for command execution".into(),
5559
}
@@ -68,7 +72,7 @@ impl CommandExecutor for MountainEnvironment {
6872
);
6973
let RPCParameters = json!([ProxiedCommandIdentifier, Argument]);
7074
let RPCMethod = format!("{}$ExecuteContributedCommand", ProxyTarget::ExtHostCommands.GetTargetPrefix());
71-
Client::SendRequest(SidecarIdentifier, RPCMethod, RPCParameters, 30000).await
75+
Client::SendRequest(&SidecarIdentifier, RPCMethod, RPCParameters, 30000).await
7276
},
7377
None => {
7478
error!("[CommandProvider] Command '{}' not found in registry.", CommandIdentifier);

Source/Environment/ConfigurationProvider.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,23 @@
55
//! configuration management, including reading, merging, updating, and
66
//! inspecting settings from various sources.
77
8-
use std::path::PathBuf;
8+
use std::{path::PathBuf, sync::Arc};
99

1010
use Common::{
1111
Configuration::{
12-
ConfigurationInspector,
13-
ConfigurationProvider,
14-
DTO::{ConfigurationOverridesDTO, ConfigurationTarget, InspectResultDataDTO},
12+
ConfigurationInspector::ConfigurationInspector,
13+
ConfigurationProvider::ConfigurationProvider,
14+
DTO::{
15+
ConfigurationOverridesDTO::ConfigurationOverridesDTO,
16+
ConfigurationTarget::ConfigurationTarget,
17+
InspectResultDataDTO::InspectResultDataDTO,
18+
},
1519
},
1620
Error::CommonError::CommonError,
17-
FileSystem::{FileSystemReader, FileSystemWriter},
21+
FileSystem::{FileSystemReader::FileSystemReader, FileSystemWriter::FileSystemWriter},
1822
};
1923
use async_trait::async_trait;
20-
use log::{debug, error, info, warn};
24+
use log::{debug, info, warn};
2125
use serde_json::{Map, Value};
2226

2327
use super::MountainEnvironment::MountainEnvironment;
@@ -164,7 +168,9 @@ pub async fn InitializeAndMergeConfigurations(Environment:&MountainEnvironment)
164168
}
165169
}
166170

167-
let FinalConfig = crate::ApplicationState::DTO::MergedConfigurationStateDTO::Create(Value::Object(Merged));
171+
let FinalConfig = crate::ApplicationState::DTO::MergedConfigurationStateDTO::MergedConfigurationStateDTO::Create(
172+
Value::Object(Merged),
173+
);
168174

169175
// Update the central application state.
170176
*Environment.ApplicationState.Configuration.lock().unwrap() = FinalConfig.clone();

Source/Environment/CustomEditorProvider.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! Implements the `CustomEditorProvider` trait for the `MountainEnvironment`.
44
//! This is currently a stub implementation.
55
6-
use Common::{CustomEditor::CustomEditorProvider, Error::CommonError};
6+
use Common::{CustomEditor::CustomEditorProvider::CustomEditorProvider, Error::CommonError::CommonError};
77
use async_trait::async_trait;
88
use log::warn;
99
use serde_json::Value;

Source/Environment/DiagnosticProvider.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
//! including storing diagnostics from various sources and notifying the UI of
66
//! changes.
77
8-
use Common::{Diagnostic::DiagnosticManager, Error::CommonError, LanguageFeature::DTO::MarkerDataDTO};
8+
use Common::{
9+
Diagnostic::DiagnosticManager::DiagnosticManager,
10+
Error::CommonError::CommonError,
11+
LanguageFeature::DTO::MarkerDataDTO,
12+
};
913
use async_trait::async_trait;
1014
use log::{debug, error, info};
1115
use serde_json::{Value, json};

Source/Environment/DocumentProvider.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@
88
use std::sync::Arc;
99

1010
use Common::{
11-
Document::DocumentProvider,
11+
Document::DocumentProvider::DocumentProvider,
1212
Error::CommonError::CommonError,
13-
FileSystem::{FileSystemReader, FileSystemWriter},
14-
IPC::IPCProvider,
13+
FileSystem::{FileSystemReader::FileSystemReader, FileSystemWriter::FileSystemWriter},
14+
IPC::IPCProvider::IPCProvider,
1515
};
1616
use async_trait::async_trait;
1717
use log::{error, info, trace, warn};
1818
use serde_json::{Value, json};
1919
use url::Url;
2020

2121
use super::{MountainEnvironment::MountainEnvironment, Utility};
22-
use crate::ApplicationState::DTO::DocumentStateDTO;
22+
use crate::ApplicationState::DTO::DocumentStateDTO::DocumentStateDTO;
2323

2424
#[async_trait]
2525
impl DocumentProvider for MountainEnvironment {

Source/Environment/FileSystemProvider.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
//! `MountainEnvironment`, providing the concrete logic for all filesystem
55
//! operations.
66
7-
use std::path::{Path, PathBuf};
7+
use std::path::PathBuf;
88

99
use Common::{
1010
Error::CommonError::CommonError,
1111
FileSystem::{
12-
DTO::{FileSystemStatDTO, FileTypeDTO},
13-
FileSystemReader,
14-
FileSystemWriter,
12+
DTO::{FileSystemStatDTO::FileSystemStatDTO, FileTypeDTO::FileTypeDTO},
13+
FileSystemReader::FileSystemReader,
14+
FileSystemWriter::FileSystemWriter,
1515
},
1616
};
1717
use async_trait::async_trait;

Source/Environment/IPCProvider.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! provider serves as a simple bridge, delegating all IPC operations directly
55
//! to the `Vine` gRPC client.
66
7-
use Common::{Error::CommonError::CommonError, IPC::IPCProvider};
7+
use Common::{Error::CommonError::CommonError, IPC::IPCProvider::IPCProvider};
88
use async_trait::async_trait;
99
use serde_json::Value;
1010

Source/Environment/LanguageFeatureProvider.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ use std::sync::Arc;
99

1010
use Common::{
1111
Error::CommonError::CommonError,
12-
IPC::IPCProvider,
12+
IPC::IPCProvider::IPCProvider,
1313
LanguageFeature::{
14-
DTO::*, // Import all DTOs from the feature
15-
LanguageFeatureProviderRegistry,
14+
DTO::{HoverResultDTO::HoverResultDTO, PositionDTO::PositionDTO, ProviderType::ProviderType},
15+
LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry,
1616
},
1717
};
1818
use async_trait::async_trait;
@@ -22,7 +22,7 @@ use serde_json::{Value, json};
2222
use url::Url;
2323

2424
use super::{MountainEnvironment::MountainEnvironment, Utility};
25-
use crate::ApplicationState::DTO::ProviderRegistrationDTO;
25+
use crate::ApplicationState::DTO::ProviderRegistrationDTO::ProviderRegistrationDTO;
2626

2727
#[async_trait]
2828
impl LanguageFeatureProviderRegistry for MountainEnvironment {

Source/Environment/MountainEnvironment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use Common::{
3030
WorkSpace::{WorkSpaceEditApplier::WorkSpaceEditApplier, WorkSpaceProvider::WorkSpaceProvider},
3131
};
3232
use log::info;
33-
use tauri::{Manager, Runtime};
33+
use tauri::{AppHandle, Manager};
3434

3535
use crate::ApplicationState::ApplicationState::ApplicationState;
3636

0 commit comments

Comments
 (0)