Skip to content

API turboframe.ui.completion

rafageist edited this page Dec 4, 2026 · 4 revisions

turboframe.ui.completion

Source: turboframe/ui/completion.py. Generated from the code of TurboFrame 0.3.0 by tools/wiki_api.py.

The completion list shown under the cursor (Turbo Vision menu look).

It never takes the focus: the editor keeps it and forwards Up/Down, PgUp/PgDn, Enter/Tab and Esc while the list is open; everything else is typed into the editor, and the list follows what is typed. InfoPopup is the box of a call's signature, or of the selected completion's documentation.

A provider (a language's own completion, or a language server's) returns a CompletionResult: where the replaced text starts, the prefix typed so far and the Completion items. The editor that hosts the popups shows it with CompletionPopup.show and implements accept_completion(), which the popup calls when an item is clicked.

Contents

CARET, Completion, CompletionResult, CompletionPopup, InfoPopup, signature_lines

CARET

'\x00'

class Completion

class Completion
Completion(label: str, insert: str, detail: str = '', after: str = '', retrigger: bool = False, extra: tuple = (), data: object = None)

One item of the list: what it shows (label, detail) and what accepting it inserts.

class CompletionResult

class CompletionResult
CompletionResult(start: int, prefix: str, items: list[Completion] = <factory>, context: str = '')

What a provider found at the cursor: the items replace text[start:cursor] (prefix).

class CompletionPopup

class CompletionPopup(Widget)
CompletionPopup(owner)

The list of completions under the cursor; owner is the editor that opened it.

  • show(result: CompletionResult, *, explicit: bool, at: tuple[int, int], screen_size: tuple[int, int]) -> None
  • move(delta: int) -> None
  • page(direction: int) -> None

class InfoPopup

class InfoPopup(Widget)
InfoPopup(kind: str)

A box of text next to the cursor: a call's signature, or the documentation of the selected completion. Like the completion list it never takes the focus.

show(lines, at, mark=(line, start, end)): mark is drawn highlighted (the parameter being typed).

  • wrap(text: str, width: int, rows: int) -> list[str]
  • show(lines: list[str], *, x: int, y: int, mark: tuple[int, int, int] | None = None) -> None
  • hide() -> None

signature_lines

def signature_lines(label: str, start: int, end: int, doc: str, width: int) -> tuple[list[str], tuple[int, int, int] | None]

A signature in a box width wide: the label on one line (cut around the parameter being typed when too long) and the documentation under it.

Clone this wiki locally