Mountain/Environment/LanguageFeatureProvider/
mod.rs1use CommonLibrary::{
19 Error::CommonError::CommonError,
20 LanguageFeature::{
21 DTO::{
22 CompletionContextDTO::CompletionContextDTO,
23 CompletionListDTO::CompletionListDTO,
24 HoverResultDTO::HoverResultDTO,
25 LocationDTO::LocationDTO,
26 PositionDTO::PositionDTO,
27 ProviderType::ProviderType,
28 TextEditDTO::TextEditDTO,
29 },
30 LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry,
31 },
32};
33use async_trait::async_trait;
34use serde_json::Value;
35use url::Url;
36
37use crate::Environment::MountainEnvironment::MountainEnvironment;
38
39mod Registration;
41mod ProviderLookup;
42mod FeatureMethods;
43
44#[async_trait]
45impl LanguageFeatureProviderRegistry for MountainEnvironment {
46 async fn RegisterProvider(
47 &self,
48 SideCarIdentifier:String,
49 ProviderType:ProviderType,
50 SelectorDTO:Value,
51 ExtensionIdentifierDTO:Value,
52 OptionsDTO:Option<Value>,
53 ) -> Result<u32, CommonError> {
54 Registration::register_provider(
55 self,
56 SideCarIdentifier,
57 ProviderType,
58 SelectorDTO,
59 ExtensionIdentifierDTO,
60 OptionsDTO,
61 )
62 .await
63 }
64
65 async fn UnregisterProvider(&self, Handle:u32) -> Result<(), CommonError> {
66 Registration::unregister_provider(self, Handle).await
67 }
68
69 async fn ProvideCodeActions(
70 &self,
71 DocumentURI:Url,
72 RangeOrSelectionDTO:Value,
73 ContextDTO:Value,
74 ) -> Result<Option<Value>, CommonError> {
75 FeatureMethods::provide_code_actions(self, DocumentURI, RangeOrSelectionDTO, ContextDTO).await
76 }
77
78 async fn ProvideCodeLenses(&self, DocumentURI:Url) -> Result<Option<Value>, CommonError> {
79 FeatureMethods::provide_code_lenses(self, DocumentURI).await
80 }
81
82 async fn ProvideCompletions(
83 &self,
84 DocumentURI:Url,
85 PositionDTO:PositionDTO,
86 ContextDTO:CompletionContextDTO,
87 CancellationTokenValue:Option<Value>,
88 ) -> Result<Option<CompletionListDTO>, CommonError> {
89 FeatureMethods::provide_completions(self, DocumentURI, PositionDTO, ContextDTO, CancellationTokenValue).await
90 }
91
92 async fn ProvideDefinition(
93 &self,
94 DocumentURI:Url,
95 PositionDTO:PositionDTO,
96 ) -> Result<Option<Vec<LocationDTO>>, CommonError> {
97 FeatureMethods::provide_definition(self, DocumentURI, PositionDTO).await
98 }
99
100 async fn ProvideDocumentFormattingEdits(
101 &self,
102 DocumentURI:Url,
103 OptionsDTO:Value,
104 ) -> Result<Option<Vec<TextEditDTO>>, CommonError> {
105 FeatureMethods::provide_document_formatting_edits(self, DocumentURI, OptionsDTO).await
106 }
107
108 async fn ProvideDocumentHighlights(
109 &self,
110 DocumentURI:Url,
111 PositionDTO:PositionDTO,
112 ) -> Result<Option<Value>, CommonError> {
113 FeatureMethods::provide_document_highlights(self, DocumentURI, PositionDTO).await
114 }
115
116 async fn ProvideDocumentLinks(&self, DocumentURI:Url) -> Result<Option<Value>, CommonError> {
117 FeatureMethods::provide_document_links(self, DocumentURI).await
118 }
119
120 async fn ProvideDocumentRangeFormattingEdits(
121 &self,
122 DocumentURI:Url,
123 RangeDTO:Value,
124 OptionsDTO:Value,
125 ) -> Result<Option<Vec<TextEditDTO>>, CommonError> {
126 FeatureMethods::provide_document_range_formatting_edits(self, DocumentURI, RangeDTO, OptionsDTO).await
127 }
128
129 async fn ProvideHover(
130 &self,
131 DocumentURI:Url,
132 PositionDTO:PositionDTO,
133 ) -> Result<Option<HoverResultDTO>, CommonError> {
134 FeatureMethods::provide_hover(self, DocumentURI, PositionDTO).await
135 }
136
137 async fn ProvideReferences(
138 &self,
139 DocumentURI:Url,
140 PositionDTO:PositionDTO,
141 ContextDTO:Value,
142 ) -> Result<Option<Vec<LocationDTO>>, CommonError> {
143 FeatureMethods::provide_references(self, DocumentURI, PositionDTO, ContextDTO).await
144 }
145
146 async fn PrepareRename(&self, DocumentURI:Url, PositionDTO:PositionDTO) -> Result<Option<Value>, CommonError> {
147 FeatureMethods::prepare_rename(self, DocumentURI, PositionDTO).await
148 }
149
150 async fn ProvideRenameEdits(
151 &self,
152 DocumentURI:Url,
153 PositionDTO:PositionDTO,
154 NewName:String,
155 ) -> Result<Option<Value>, CommonError> {
156 FeatureMethods::provide_rename_edits(self, DocumentURI, PositionDTO, NewName).await
157 }
158 async fn ProvideDocumentSymbols(&self, DocumentURI:Url) -> Result<Option<Value>, CommonError> {
159 FeatureMethods::provide_document_symbols(self, DocumentURI).await
160 }
161 async fn ProvideWorkspaceSymbols(&self, Query:String) -> Result<Option<Value>, CommonError> {
162 FeatureMethods::provide_workspace_symbols(self, Query).await
163 }
164 async fn ProvideSignatureHelp(
165 &self,
166 DocumentURI:Url,
167 PositionDTO:PositionDTO,
168 ContextDTO:Value,
169 ) -> Result<Option<Value>, CommonError> {
170 FeatureMethods::provide_signature_help(self, DocumentURI, PositionDTO, ContextDTO).await
171 }
172 async fn ProvideFoldingRanges(&self, DocumentURI:Url) -> Result<Option<Value>, CommonError> {
173 FeatureMethods::provide_folding_ranges(self, DocumentURI).await
174 }
175 async fn ProvideSelectionRanges(
176 &self,
177 DocumentURI:Url,
178 Positions:Vec<PositionDTO>,
179 ) -> Result<Option<Value>, CommonError> {
180 FeatureMethods::provide_selection_ranges(self, DocumentURI, Positions).await
181 }
182 async fn ProvideSemanticTokensFull(&self, DocumentURI:Url) -> Result<Option<Value>, CommonError> {
183 FeatureMethods::provide_semantic_tokens_full(self, DocumentURI).await
184 }
185 async fn ProvideInlayHints(&self, DocumentURI:Url, RangeDTO:Value) -> Result<Option<Value>, CommonError> {
186 FeatureMethods::provide_inlay_hints(self, DocumentURI, RangeDTO).await
187 }
188 async fn ProvideTypeHierarchySupertypes(&self, ItemDTO:Value) -> Result<Option<Value>, CommonError> {
189 FeatureMethods::provide_type_hierarchy_supertypes(self, ItemDTO).await
190 }
191 async fn ProvideTypeHierarchySubtypes(&self, ItemDTO:Value) -> Result<Option<Value>, CommonError> {
192 FeatureMethods::provide_type_hierarchy_subtypes(self, ItemDTO).await
193 }
194 async fn ProvideCallHierarchyIncomingCalls(&self, ItemDTO:Value) -> Result<Option<Value>, CommonError> {
195 FeatureMethods::provide_call_hierarchy_incoming_calls(self, ItemDTO).await
196 }
197 async fn ProvideCallHierarchyOutgoingCalls(&self, ItemDTO:Value) -> Result<Option<Value>, CommonError> {
198 FeatureMethods::provide_call_hierarchy_outgoing_calls(self, ItemDTO).await
199 }
200 async fn ProvideLinkedEditingRanges(
201 &self,
202 DocumentURI:Url,
203 PositionDTO:PositionDTO,
204 ) -> Result<Option<Value>, CommonError> {
205 FeatureMethods::provide_linked_editing_ranges(self, DocumentURI, PositionDTO).await
206 }
207 async fn ProvideOnTypeFormattingEdits(
208 &self,
209 DocumentURI:Url,
210 PositionDTO:PositionDTO,
211 Character:String,
212 OptionsDTO:Value,
213 ) -> Result<Option<Vec<TextEditDTO>>, CommonError> {
214 FeatureMethods::provide_on_type_formatting_edits(self, DocumentURI, PositionDTO, Character, OptionsDTO).await
215 }
216}