f
depth(source: string): number
How many brackets are open at the end of the source — what a continuation prompt counts.
f
highlight(): string
source: string,
palette: Theme
Source as the terminal should draw it: every token wrapped in its capture's style.
f
tokenize(source: string): Token[]
The source, split into what nvim would capture.
I
Token
A run of source, and what nvim's treesitter queries would capture it as.
-
capture: string
An nvim capture name —
@keyword.return,@string,@punctuation.bracket. -
end: number
Index after the last character.
-
start: number
Index of the first character.
Usage
import * as mod from "lib/repl/highlight.ts";