CommonLibrary/LanguageFeature/
LanguageFeatureProviderRegistry.rs1use async_trait::async_trait;
18use serde_json::Value;
19use url::Url;
20
21use super::DTO::{
22 CompletionContextDTO::CompletionContextDTO,
23 CompletionListDTO::CompletionListDTO,
24 HoverResultDTO::HoverResultDTO,
25 LocationDTO::LocationDTO,
26 PositionDTO::PositionDTO,
27 ProviderType::ProviderType,
28 TextEditDTO::TextEditDTO,
29};
30use crate::{Environment::Environment::Environment, Error::CommonError::CommonError};
31
32#[async_trait]
40pub trait LanguageFeatureProviderRegistry: Environment + Send + Sync {
41 async fn RegisterProvider(
57 &self,
58
59 SideCarIdentifier:String,
60
61 ProviderType:ProviderType,
62
63 SelectorDTO:Value,
64
65 ExtensionIdentifierDTO:Value,
66
67 OptionsDTO:Option<Value >,
68 ) -> Result<u32, CommonError>;
69
70 async fn UnregisterProvider(&self, Handle:u32) -> Result<(), CommonError>;
75
76 async fn ProvideCodeActions(
79 &self,
80
81 DocumentURI:Url,
82
83 RangeOrSelectionDTO:Value,
85
86 ContextDTO:Value,
88 ) -> Result<Option<Value >, CommonError>;
89
90 async fn ProvideCodeLenses(&self, DocumentURI:Url) -> Result<Option<Value >, CommonError>;
91
92 async fn ProvideCompletions(
93 &self,
94
95 DocumentURI:Url,
96
97 PositionDTO:PositionDTO,
98
99 ContextDTO:CompletionContextDTO,
100
101 CancellationTokenValue:Option<Value>,
102 ) -> Result<Option<CompletionListDTO>, CommonError>;
103
104 async fn ProvideDefinition(
105 &self,
106
107 DocumentURI:Url,
108
109 PositionDTO:PositionDTO,
110 ) -> Result<Option<Vec<LocationDTO>>, CommonError>;
111
112 async fn ProvideDocumentFormattingEdits(
113 &self,
114
115 DocumentURI:Url,
116
117 OptionsDTO:Value,
119 ) -> Result<Option<Vec<TextEditDTO>>, CommonError>;
120
121 async fn ProvideDocumentHighlights(
122 &self,
123
124 DocumentURI:Url,
125
126 PositionDTO:PositionDTO,
127 ) -> Result<Option<Value >, CommonError>;
128
129 async fn ProvideDocumentLinks(&self, DocumentURI:Url) -> Result<Option<Value >, CommonError>;
130
131 async fn ProvideDocumentRangeFormattingEdits(
132 &self,
133
134 DocumentURI:Url,
135
136 RangeDTO:Value,
138
139 OptionsDTO:Value,
141 ) -> Result<Option<Vec<TextEditDTO>>, CommonError>;
142
143 async fn ProvideHover(
144 &self,
145
146 DocumentURI:Url,
147
148 PositionDTO:PositionDTO,
149 ) -> Result<Option<HoverResultDTO>, CommonError>;
150
151 async fn ProvideReferences(
152 &self,
153
154 DocumentURI:Url,
155
156 PositionDTO:PositionDTO,
157
158 ContextDTO:Value,
160 ) -> Result<Option<Vec<LocationDTO>>, CommonError>;
161
162 async fn PrepareRename(&self, DocumentURI:Url, PositionDTO:PositionDTO) -> Result<Option<Value>, CommonError>;
163
164 async fn ProvideRenameEdits(
166 &self,
167 DocumentURI:Url,
168 PositionDTO:PositionDTO,
169 NewName:String,
170 ) -> Result<Option<Value >, CommonError>;
171
172 async fn ProvideDocumentSymbols(
174 &self,
175 DocumentURI:Url,
176 ) -> Result<Option<Value >, CommonError>;
177
178 async fn ProvideWorkspaceSymbols(
180 &self,
181 Query:String,
182 ) -> Result<Option<Value >, CommonError>;
183
184 async fn ProvideSignatureHelp(
186 &self,
187 DocumentURI:Url,
188 PositionDTO:PositionDTO,
189 ContextDTO:Value,
190 ) -> Result<Option<Value >, CommonError>;
191
192 async fn ProvideFoldingRanges(
194 &self,
195 DocumentURI:Url,
196 ) -> Result<Option<Value >, CommonError>;
197
198 async fn ProvideSelectionRanges(
200 &self,
201 DocumentURI:Url,
202 Positions:Vec<PositionDTO>,
203 ) -> Result<Option<Value >, CommonError>;
204
205 async fn ProvideSemanticTokensFull(
207 &self,
208 DocumentURI:Url,
209 ) -> Result<Option<Value >, CommonError>;
210
211 async fn ProvideInlayHints(
213 &self,
214 DocumentURI:Url,
215 RangeDTO:Value,
216 ) -> Result<Option<Value >, CommonError>;
217
218 async fn ProvideTypeHierarchySupertypes(
220 &self,
221 ItemDTO:Value,
222 ) -> Result<Option<Value >, CommonError>;
223
224 async fn ProvideTypeHierarchySubtypes(
226 &self,
227 ItemDTO:Value,
228 ) -> Result<Option<Value >, CommonError>;
229
230 async fn ProvideCallHierarchyIncomingCalls(
232 &self,
233 ItemDTO:Value,
234 ) -> Result<Option<Value >, CommonError>;
235
236 async fn ProvideCallHierarchyOutgoingCalls(
238 &self,
239 ItemDTO:Value,
240 ) -> Result<Option<Value >, CommonError>;
241
242 async fn ProvideLinkedEditingRanges(
244 &self,
245 DocumentURI:Url,
246 PositionDTO:PositionDTO,
247 ) -> Result<Option<Value >, CommonError>;
248
249 async fn ProvideOnTypeFormattingEdits(
251 &self,
252 DocumentURI:Url,
253 PositionDTO:PositionDTO,
254 Character:String,
255 OptionsDTO:Value,
256 ) -> Result<Option<Vec<TextEditDTO>>, CommonError>;
257}