Common/WorkSpace/
GetWorkSpaceFoldersInfo.rs

1//! # GetWorkSpaceFoldersInfo Effect
2//!
3//! Defines the `ActionEffect` for retrieving information about all open
4//! workspace folders.
5
6use std::sync::Arc;
7
8use url::Url;
9
10use super::WorkSpaceProvider::WorkSpaceProvider;
11use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError};
12
13/// Creates an effect that, when executed, will retrieve information about all
14/// currently open workspace folders.
15///
16/// It uses the `WorkSpaceProvider` capability from the environment to perform
17/// the operation.
18///
19/// # Returns
20/// An `ActionEffect` that resolves with a `Vec` of tuples, where each tuple
21/// contains the folder's `Url`, its name as a `String`, and its zero-based
22/// index.
23pub fn GetWorkSpaceFoldersInfo() -> ActionEffect<Arc<dyn WorkSpaceProvider>, CommonError, Vec<(Url, String, usize)>> {
24	ActionEffect::New(Arc::new(move |Provider:Arc<dyn WorkSpaceProvider>| {
25		Box::pin(async move { Provider.GetWorkSpaceFoldersInfo().await })
26	}))
27}