Skip to main content

CommonLibrary/LanguageFeature/
ProvideLinkedEditingRanges.rs

1//! # ProvideLinkedEditingRanges Effect
2//!
3//! Defines the `ActionEffect` for requesting linked editing ranges from a
4//! language feature provider.
5
6use std::sync::Arc;
7
8use serde_json::Value;
9use url::Url;
10
11use super::{DTO::PositionDTO::PositionDTO, LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry};
12use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError};
13
14/// Creates an effect that, when executed, will request linked editing ranges.
15pub fn ProvideLinkedEditingRanges(
16	DocumentURI:Url,
17
18	PositionDTO:PositionDTO,
19) -> ActionEffect<Arc<dyn LanguageFeatureProviderRegistry>, CommonError, Option<Value>> {
20	ActionEffect::New(Arc::new(move |Registry:Arc<dyn LanguageFeatureProviderRegistry>| {
21		let DocumentURIClone = DocumentURI.clone();
22
23		Box::pin(async move { Registry.ProvideLinkedEditingRanges(DocumentURIClone, PositionDTO).await })
24	}))
25}