get_function_completions

Function get_function_completions 

Source
pub fn get_function_completions(
    ctx: &FunctionCompletionContext,
) -> Vec<CompletionItem>
Expand description

Gets function completions filtered and scored by context.

This function returns SQL functions as completion items, filtered by prefix and with scoring adjustments based on the current context:

  • Aggregate functions are boosted when GROUP BY is present
  • Aggregate functions are penalized in WHERE clause
  • Window functions are boosted in OVER/WINDOW context

ยงPerformance

Uses a pre-computed cache of function items. On each call, we:

  1. Filter the cache by prefix (if provided)
  2. Clone matching items
  3. Apply context-based scoring

This avoids re-computing signatures and format strings on every request.