Skip to main content

CommonLibrary/LanguageFeature/
ProvideCodeLenses.rs

1//! # ProvideCodeLenses Effect
2//!
3//! Defines the `ActionEffect` for requesting code lenses 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 code lenses.
15pub fn ProvideCodeLenses(
16	DocumentURI:Url,
17) -> ActionEffect<Arc<dyn LanguageFeatureProviderRegistry>, CommonError, Option<Value>> {
18	ActionEffect::New(Arc::new(move |Registry:Arc<dyn LanguageFeatureProviderRegistry>| {
19		let DocumentURIClone = DocumentURI.clone();
20
21		Box::pin(async move { Registry.ProvideCodeLenses(DocumentURIClone).await })
22	}))
23}