pub trait CompletionProvider: Send + Sync {
// Required methods
fn language(&self) -> &str;
fn generate_completions<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
code: &'life1 str,
position: Position,
context: &'life2 CompletionContext,
) -> Pin<Box<dyn Future<Output = CompletionResult<Vec<CompletionItem>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
Pluggable completion provider for language-specific behavior
Implementations provide language-specific completion suggestions. Providers are
registered in the ProviderRegistry and selected based on the language identifier.
§Language Support
Each provider supports a single language. The engine queries the registry to find the appropriate provider for the current language.
§Implementations
RustCompletionProvider: Rust-specific completionsTypeScriptCompletionProvider: TypeScript-specific completionsPythonCompletionProvider: Python-specific completionsGenericTextProvider: Generic text-based completions
§Example
ⓘ
use ricecoder_completion::providers::RustCompletionProvider;
use ricecoder_completion::engine::CompletionProvider;
let provider = RustCompletionProvider;
assert_eq!(provider.language(), "rust");Required Methods§
Sourcefn language(&self) -> &str
fn language(&self) -> &str
Get the language this provider supports
§Returns
A language identifier string (e.g., “rust”, “typescript”, “python”).