split(line: string): Typed | null
Where a completion would go in line, or null where none could.
The base is what makes this worth separating from the matching: it decides whether the page gets asked at all, and it deliberately refuses anything that is not a plain dotted path.
import { split } from './suggest.ts'; split('1 + document.ti'); // { base: 'document', token: 'ti' } split('document.'); // { base: 'document', token: '' } — everything on it split('foo().b'); // null — finding out what `foo()` returns means calling it split('const x = '); // null — a name has to have started split("alert('he"); // null — inside a string, where `he` is text and not a name
Typed | null