What TAB offers: dot commands on a line that starts with one, page identifiers everywhere else.
Opens a cache over one session's completions, kept between keystrokes and refreshed behind them.
The terminal escape sequence the GHOST SUGGESTION is drawn in — grey, so it reads as something offered rather than something typed.
The path being typed on a .cat or .view line, or null on any other line.
Every path that continues typed, spelled the way it was — directories with a trailing slash.
What to draw after the cursor on a path line: the rest of the shortest path that continues it.
zsh-style typeahead: the rest of the last matching line, greyed out after the cursor, Ctrl-F to take it.
The page's identifiers, as something a keystroke can read.
-
ask(base: string): Promise<readonly string[]>
The page's answer for
base, waited for. What TAB uses, where a moment is affordable. -
lookup(base: string): readonly string[]
Names on
baseas of the last answer — empty while the first one is in flight. -
stale(): void
Marks every answer worth asking for again.
-
subscribe(listener: () => void): void
Called whenever a late answer arrives, so what is on screen can be drawn again.
What node:repl hands a completer to answer through: the matches, and the word they finish.
Usage
import * as mod from "lib/commands/repl/completion.ts";