CommonLibrary/LanguageFeature/ProvideSemanticTokens.rs
1//! # ProvideSemanticTokens Effect
2//!
3//! Defines the `ActionEffect` for requesting semantic tokens 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 semantic tokens.
15pub fn ProvideSemanticTokens(
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.ProvideSemanticTokensFull(DocumentURIClone).await })
22 }))
23}