Skip to main content

CommonLibrary/LanguageFeature/
ProvideInlayHints.rs

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