ReplSession.completions(base: string): Promise<string[]>
What could come next after base: its own properties, or everything in scope at top level
when base is ''.
What both the greyed-out suggestion and TAB are drawn from, so the two agree by construction
rather than by two lists kept in step. One caller, completion.ts, which feeds both — and
which caches these, so repl.completionCache is the cached front and this is the page itself.
It has to come from the page: the completions for document.body. are a list only the page
holds, and one assembled in Node would offer names this document does not have. Resolves
empty for anything it cannot answer — a base that is not a plain dotted path, a closed session
— because a completion is a convenience and never a reason for a prompt to report an error.
import type { ReplSession } from './session.ts'; // Defined, not invoked: a real session owns a browser and a bound port. async function offer(session: ReplSession) { await session.completions('document'); // ['body', 'title', 'querySelector', …] return await session.completions(''); // what is in scope, including what you declared }