CompletionGenerator

Trait CompletionGenerator 

Source
pub trait CompletionGenerator: Send + Sync {
    // Required method
    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

Completion generator trait

Implementations generate completion suggestions based on code context. This is typically used as a fallback when no language-specific provider is available.

§Implementations

  • BasicCompletionGenerator: Generic text-based completion
  • Language-specific providers: Rust, TypeScript, Python

Required Methods§

Source

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,

Generate completion suggestions

§Arguments
  • code - The source code to analyze
  • position - The cursor position where completions are requested
  • context - The analyzed code context
§Returns

A vector of completion items (not yet ranked), or an error if generation fails.

Implementors§