CommonLibrary/LanguageFeature/ProvideDocumentHighlights.rs
1//! # ProvideDocumentHighlights Effect
2//!
3//! Defines the `ActionEffect` for requesting document highlights 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 document highlights.
15pub fn ProvideDocumentHighlights(
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.ProvideDocumentHighlights(DocumentURIClone, PositionDTO).await })
24 }))
25}