CommonLibrary/LanguageFeature/
ProvideOnTypeFormatting.rs1use std::sync::Arc;
7
8use serde_json::Value;
9use url::Url;
10
11use super::{
12 DTO::{PositionDTO::PositionDTO, TextEditDTO::TextEditDTO},
13 LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry,
14};
15use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError};
16
17pub fn ProvideOnTypeFormatting(
20 DocumentURI:Url,
21
22 PositionDTO:PositionDTO,
23
24 Character:String,
25
26 OptionsDTO:Value,
27) -> ActionEffect<Arc<dyn LanguageFeatureProviderRegistry>, CommonError, Option<Vec<TextEditDTO>>> {
28 ActionEffect::New(Arc::new(move |Registry:Arc<dyn LanguageFeatureProviderRegistry>| {
29 let DocumentURIClone = DocumentURI.clone();
30
31 let CharacterClone = Character.clone();
32
33 let OptionsDTOClone = OptionsDTO.clone();
34
35 Box::pin(async move {
36 Registry
37 .ProvideOnTypeFormattingEdits(DocumentURIClone, PositionDTO, CharacterClone, OptionsDTOClone)
38 .await
39 })
40 }))
41}