Skip to main content

CommonLibrary/LanguageFeature/
ProvideSignatureHelp.rs

1//! # ProvideSignatureHelp Effect
2//!
3//! Defines the `ActionEffect` for requesting signature help from a language
4//! 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 signature help.
15pub fn ProvideSignatureHelp(
16	DocumentURI:Url,
17
18	PositionDTO:PositionDTO,
19
20	ContextDTO:Value,
21) -> ActionEffect<Arc<dyn LanguageFeatureProviderRegistry>, CommonError, Option<Value>> {
22	ActionEffect::New(Arc::new(move |Registry:Arc<dyn LanguageFeatureProviderRegistry>| {
23		let DocumentURIClone = DocumentURI.clone();
24		let ContextDTOClone = ContextDTO.clone();
25
26		Box::pin(async move {
27			Registry
28				.ProvideSignatureHelp(DocumentURIClone, PositionDTO, ContextDTOClone)
29				.await
30		})
31	}))
32}