Skip to content

API turboframe.lsp

rafageist edited this page Dec 4, 2026 · 5 revisions

turboframe.lsp

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

What the Language Server Protocol counts, as the editor counts it.

The protocol places a position by line and column in UTF-16 code units; the editor by character offset in its text. Completions may come as snippets (${1:name}) and hovers as Markdown: both become plain text here.

Contents

clean_hover, from_snippet, line_starts, plain_markup, to_offset, to_position

clean_hover

def clean_hover(text: str) -> str

Markdown's fences, heading marks, rules and escapes out of a hover; blank runs squeezed.

from_snippet

def from_snippet(text: str, caret: str) -> str

A snippet as plain text: placeholders keep their default text, the first tab stop (or $0) becomes caret.

line_starts

def line_starts(text: str) -> list[int]

plain_markup

def plain_markup(value) -> str

Hover contents (MarkupContent, MarkedString or a list) as text.

to_offset

def to_offset(text: str, line: int, character: int, starts: list[int] | None = None) -> int

(line, UTF-16 column) -> text offset (clamped to the line).

to_position

def to_position(text: str, offset: int, starts: list[int] | None = None) -> tuple[int, int]

Text offset -> (line, UTF-16 column).

Clone this wiki locally