Skip to content

Commit 2bca2de

Browse files
feat(Common): Add remaining language feature provider methods and effects
Complete the LanguageFeatureProviderRegistry trait by adding 15 missing provider methods covering the full LSP feature set: - Navigation: Definition, References, TypeHierarchy (super/subtypes), CallHierarchy (in/out) - Symbols: DocumentSymbols, WorkspaceSymbols - Code actions: RenameEdits, CodeActions, CodeLenses - Formatting: DocumentFormatting, OnTypeFormatting - Analysis: SemanticTokens, InlayHints, SelectionRanges, LinkedEditingRanges, DocumentHighlights - Signature: SignatureHelp, FoldingRanges Corresponding ActionEffect modules created for each provider method, enabling Wind/Sky to request these features via the registry. Transport module files renamed to proper acronym casing (gRPC, IPC, WASM).
1 parent 5264df7 commit 2bca2de

24 files changed

Lines changed: 584 additions & 9 deletions

Source/LanguageFeature/LanguageFeatureProviderRegistry.rs

Lines changed: 93 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,5 +161,97 @@ pub trait LanguageFeatureProviderRegistry: Environment + Send + Sync {
161161

162162
async fn PrepareRename(&self, DocumentURI:Url, PositionDTO:PositionDTO) -> Result<Option<Value>, CommonError>;
163163

164-
// ... other provider methods will be added here.
164+
/// Provides rename edits for a symbol at the given position.
165+
async fn ProvideRenameEdits(
166+
&self,
167+
DocumentURI:Url,
168+
PositionDTO:PositionDTO,
169+
NewName:String,
170+
) -> Result<Option<Value /* WorkspaceEditDTO */>, CommonError>;
171+
172+
/// Provides document symbols (outline) for the given document.
173+
async fn ProvideDocumentSymbols(
174+
&self,
175+
DocumentURI:Url,
176+
) -> Result<Option<Value /* Vec<DocumentSymbolDTO> */>, CommonError>;
177+
178+
/// Provides workspace symbols matching the given query.
179+
async fn ProvideWorkspaceSymbols(
180+
&self,
181+
Query:String,
182+
) -> Result<Option<Value /* Vec<WorkspaceSymbolDTO> */>, CommonError>;
183+
184+
/// Provides signature help at the given position.
185+
async fn ProvideSignatureHelp(
186+
&self,
187+
DocumentURI:Url,
188+
PositionDTO:PositionDTO,
189+
ContextDTO:Value,
190+
) -> Result<Option<Value /* SignatureHelpDTO */>, CommonError>;
191+
192+
/// Provides folding ranges for the given document.
193+
async fn ProvideFoldingRanges(
194+
&self,
195+
DocumentURI:Url,
196+
) -> Result<Option<Value /* Vec<FoldingRangeDTO> */>, CommonError>;
197+
198+
/// Provides selection ranges at the given positions.
199+
async fn ProvideSelectionRanges(
200+
&self,
201+
DocumentURI:Url,
202+
Positions:Vec<PositionDTO>,
203+
) -> Result<Option<Value /* Vec<SelectionRangeDTO> */>, CommonError>;
204+
205+
/// Provides semantic tokens for the full document.
206+
async fn ProvideSemanticTokensFull(
207+
&self,
208+
DocumentURI:Url,
209+
) -> Result<Option<Value /* SemanticTokensDTO */>, CommonError>;
210+
211+
/// Provides inlay hints within the given range.
212+
async fn ProvideInlayHints(
213+
&self,
214+
DocumentURI:Url,
215+
RangeDTO:Value,
216+
) -> Result<Option<Value /* Vec<InlayHintDTO> */>, CommonError>;
217+
218+
/// Provides type hierarchy supertypes for the given item.
219+
async fn ProvideTypeHierarchySupertypes(
220+
&self,
221+
ItemDTO:Value,
222+
) -> Result<Option<Value /* Vec<TypeHierarchyItemDTO> */>, CommonError>;
223+
224+
/// Provides type hierarchy subtypes for the given item.
225+
async fn ProvideTypeHierarchySubtypes(
226+
&self,
227+
ItemDTO:Value,
228+
) -> Result<Option<Value /* Vec<TypeHierarchyItemDTO> */>, CommonError>;
229+
230+
/// Provides call hierarchy incoming calls for the given item.
231+
async fn ProvideCallHierarchyIncomingCalls(
232+
&self,
233+
ItemDTO:Value,
234+
) -> Result<Option<Value /* Vec<CallHierarchyCallDTO> */>, CommonError>;
235+
236+
/// Provides call hierarchy outgoing calls for the given item.
237+
async fn ProvideCallHierarchyOutgoingCalls(
238+
&self,
239+
ItemDTO:Value,
240+
) -> Result<Option<Value /* Vec<CallHierarchyCallDTO> */>, CommonError>;
241+
242+
/// Provides linked editing ranges at the given position.
243+
async fn ProvideLinkedEditingRanges(
244+
&self,
245+
DocumentURI:Url,
246+
PositionDTO:PositionDTO,
247+
) -> Result<Option<Value /* LinkedEditingRangesDTO */>, CommonError>;
248+
249+
/// Provides on-type formatting edits.
250+
async fn ProvideOnTypeFormattingEdits(
251+
&self,
252+
DocumentURI:Url,
253+
PositionDTO:PositionDTO,
254+
Character:String,
255+
OptionsDTO:Value,
256+
) -> Result<Option<Vec<TextEditDTO>>, CommonError>;
165257
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//! # ProvideCallHierarchy Effect
2+
//!
3+
//! Defines the `ActionEffect` for requesting call hierarchy incoming calls from a language feature
4+
//! provider.
5+
6+
use std::sync::Arc;
7+
8+
use serde_json::Value;
9+
10+
use super::LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry;
11+
use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError};
12+
13+
/// Creates an effect that, when executed, will request call hierarchy incoming calls.
14+
pub fn ProvideCallHierarchy(
15+
ItemDTO:Value,
16+
) -> ActionEffect<Arc<dyn LanguageFeatureProviderRegistry>, CommonError, Option<Value>> {
17+
ActionEffect::New(Arc::new(move |Registry:Arc<dyn LanguageFeatureProviderRegistry>| {
18+
let ItemDTOClone = ItemDTO.clone();
19+
20+
Box::pin(async move { Registry.ProvideCallHierarchyIncomingCalls(ItemDTOClone).await })
21+
}))
22+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//! # ProvideCodeActions Effect
2+
//!
3+
//! Defines the `ActionEffect` for requesting code actions from a language feature
4+
//! provider.
5+
6+
use std::sync::Arc;
7+
8+
use serde_json::Value;
9+
use url::Url;
10+
11+
use super::LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry;
12+
use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError};
13+
14+
/// Creates an effect that, when executed, will request code actions.
15+
pub fn ProvideCodeActions(
16+
DocumentURI:Url,
17+
18+
RangeOrSelectionDTO:Value,
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 RangeOrSelectionDTOClone = RangeOrSelectionDTO.clone();
25+
let ContextDTOClone = ContextDTO.clone();
26+
27+
Box::pin(async move { Registry.ProvideCodeActions(DocumentURIClone, RangeOrSelectionDTOClone, ContextDTOClone).await })
28+
}))
29+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//! # ProvideCodeLenses Effect
2+
//!
3+
//! Defines the `ActionEffect` for requesting code lenses from a language feature
4+
//! provider.
5+
6+
use std::sync::Arc;
7+
8+
use serde_json::Value;
9+
use url::Url;
10+
11+
use super::LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry;
12+
use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError};
13+
14+
/// Creates an effect that, when executed, will request code lenses.
15+
pub fn ProvideCodeLenses(
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.ProvideCodeLenses(DocumentURIClone).await })
22+
}))
23+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//! # ProvideDefinition Effect
2+
//!
3+
//! Defines the `ActionEffect` for requesting definition locations from a language feature
4+
//! provider.
5+
6+
use std::sync::Arc;
7+
8+
use super::DTO::LocationDTO::LocationDTO;
9+
use super::DTO::PositionDTO::PositionDTO;
10+
use url::Url;
11+
12+
use super::LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry;
13+
use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError};
14+
15+
/// Creates an effect that, when executed, will request definition locations.
16+
pub fn ProvideDefinition(
17+
DocumentURI:Url,
18+
19+
PositionDTO:PositionDTO,
20+
) -> ActionEffect<Arc<dyn LanguageFeatureProviderRegistry>, CommonError, Option<Vec<LocationDTO>>> {
21+
ActionEffect::New(Arc::new(move |Registry:Arc<dyn LanguageFeatureProviderRegistry>| {
22+
let DocumentURIClone = DocumentURI.clone();
23+
24+
Box::pin(async move { Registry.ProvideDefinition(DocumentURIClone, PositionDTO).await })
25+
}))
26+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//! # ProvideDocumentFormatting Effect
2+
//!
3+
//! Defines the `ActionEffect` for requesting document formatting edits from a language feature
4+
//! provider.
5+
6+
use std::sync::Arc;
7+
8+
use serde_json::Value;
9+
use super::DTO::TextEditDTO::TextEditDTO;
10+
use url::Url;
11+
12+
use super::LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry;
13+
use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError};
14+
15+
/// Creates an effect that, when executed, will request document formatting edits.
16+
pub fn ProvideDocumentFormatting(
17+
DocumentURI:Url,
18+
19+
OptionsDTO:Value,
20+
) -> ActionEffect<Arc<dyn LanguageFeatureProviderRegistry>, CommonError, Option<Vec<TextEditDTO>>> {
21+
ActionEffect::New(Arc::new(move |Registry:Arc<dyn LanguageFeatureProviderRegistry>| {
22+
let DocumentURIClone = DocumentURI.clone();
23+
let OptionsDTOClone = OptionsDTO.clone();
24+
25+
Box::pin(async move { Registry.ProvideDocumentFormattingEdits(DocumentURIClone, OptionsDTOClone).await })
26+
}))
27+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//! # ProvideDocumentHighlights Effect
2+
//!
3+
//! Defines the `ActionEffect` for requesting document highlights from a language feature
4+
//! provider.
5+
6+
use std::sync::Arc;
7+
8+
use serde_json::Value;
9+
use super::DTO::PositionDTO::PositionDTO;
10+
use url::Url;
11+
12+
use super::LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry;
13+
use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError};
14+
15+
/// Creates an effect that, when executed, will request document highlights.
16+
pub fn ProvideDocumentHighlights(
17+
DocumentURI:Url,
18+
19+
PositionDTO:PositionDTO,
20+
) -> ActionEffect<Arc<dyn LanguageFeatureProviderRegistry>, CommonError, Option<Value>> {
21+
ActionEffect::New(Arc::new(move |Registry:Arc<dyn LanguageFeatureProviderRegistry>| {
22+
let DocumentURIClone = DocumentURI.clone();
23+
24+
Box::pin(async move { Registry.ProvideDocumentHighlights(DocumentURIClone, PositionDTO).await })
25+
}))
26+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//! # ProvideDocumentSymbols Effect
2+
//!
3+
//! Defines the `ActionEffect` for requesting document symbols from a language feature
4+
//! provider.
5+
6+
use std::sync::Arc;
7+
8+
use serde_json::Value;
9+
use url::Url;
10+
11+
use super::LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry;
12+
use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError};
13+
14+
/// Creates an effect that, when executed, will request document symbols.
15+
pub fn ProvideDocumentSymbols(
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.ProvideDocumentSymbols(DocumentURIClone).await })
22+
}))
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//! # ProvideFoldingRanges Effect
2+
//!
3+
//! Defines the `ActionEffect` for requesting folding ranges from a language feature
4+
//! provider.
5+
6+
use std::sync::Arc;
7+
8+
use serde_json::Value;
9+
use url::Url;
10+
11+
use super::LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry;
12+
use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError};
13+
14+
/// Creates an effect that, when executed, will request folding ranges.
15+
pub fn ProvideFoldingRanges(
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.ProvideFoldingRanges(DocumentURIClone).await })
22+
}))
23+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//! # ProvideInlayHints Effect
2+
//!
3+
//! Defines the `ActionEffect` for requesting inlay hints from a language feature
4+
//! provider.
5+
6+
use std::sync::Arc;
7+
8+
use serde_json::Value;
9+
use url::Url;
10+
11+
use super::LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry;
12+
use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError};
13+
14+
/// Creates an effect that, when executed, will request inlay hints.
15+
pub fn ProvideInlayHints(
16+
DocumentURI:Url,
17+
18+
RangeDTO:Value,
19+
) -> ActionEffect<Arc<dyn LanguageFeatureProviderRegistry>, CommonError, Option<Value>> {
20+
ActionEffect::New(Arc::new(move |Registry:Arc<dyn LanguageFeatureProviderRegistry>| {
21+
let DocumentURIClone = DocumentURI.clone();
22+
let RangeDTOClone = RangeDTO.clone();
23+
24+
Box::pin(async move { Registry.ProvideInlayHints(DocumentURIClone, RangeDTOClone).await })
25+
}))
26+
}

0 commit comments

Comments
 (0)