CommonLibrary/Workspace/
WorkspaceEditApplier.rs

1//! # WorkspaceEditApplier Trait
2//!
3//! Defines the `WorkspaceEditApplier` trait for applying batch edits across
4//! the workspace.
5
6use async_trait::async_trait;
7
8// Note: WorkspaceEditDTO is defined in `language_feature::DTO` as it's
9// most commonly used there, but it is a general-purpose DTO.
10use crate::DTO::WorkspaceEditDTO::WorkspaceEditDTO;
11use crate::{Environment::Environment::Environment, Error::CommonError::CommonError};
12
13/// An abstract service contract for an environment component that can apply a
14/// `WorkspaceEdit`.
15///
16/// A `WorkspaceEdit` is a complex, potentially transactional operation that can
17/// include text edits to multiple files, as well as file system operations like
18/// creating, deleting, or renaming files. This trait isolates the complex
19/// logic of applying such edits.
20#[async_trait]
21pub trait WorkspaceEditApplier: Environment + Send + Sync {
22	/// Applies the given `WorkspaceEditDTO` to the workspace.
23	///
24	/// # Parameters
25	/// * `EditDTO`: The DTO representing the batch of edits to apply.
26	///
27	/// # Returns
28	/// A `Result` indicating whether the entire edit was applied
29	/// successfully. A `false` value may indicate a partial success or a user
30	/// cancellation of one of the steps.
31	async fn ApplyWorkspaceEdit(&self, EditDTO:WorkspaceEditDTO) -> Result<bool, CommonError>;
32}