GtBridge.Completion (gt_bridge v0.17.1)

Copy Markdown View Source

I provide code completion for Elixir source fragments.

Given a code prefix string (everything from the last separator to the cursor), I call Code.Fragment.cursor_context/1 to understand what the user is typing and return matching completions from the runtime.

Public API

  • complete/1 — complete with no bindings
  • complete/2 — complete with bindings from an Eval session
  • complete/3 — complete with bindings and full source context

Summary

Functions

I return a list of completion strings for code_prefix, including variable names from bindings.

Functions

complete(code_prefix, bindings \\ [], source \\ nil, env \\ %Macro.Env{})

@spec complete(String.t(), Code.binding(), String.t() | nil, Macro.Env.t()) :: [
  String.t()
]

I return a list of completion strings for code_prefix, including variable names from bindings.

The optional third argument source is the full source text up to the cursor. When provided, it is passed through to sub-completers that may need surrounding context (e.g. struct field completion).