EditorSearch beta
Class of @v12-engine/editor
export declare class EditorSearchThe editor's search: its sources, and what was used last (kept for the next time). The editor's own sources are there from the start; a game adds its own declared (EditorOptions.search) or in code (add)
Members
constructor
constructor(sources: SearchSource[], changed?: () => void,
storage?: () => KeptStorage);Constructs a new instance of the EditorSearch class
add
add(source: SearchSource, options?: {
before?: string;
}): () => void;Adds a source: before another by id, or last. One with the id of another takes its place. Gives back what takes it out
find
find(found: readonly FoundEntry[], query: string, first?: (entry: FoundEntry) => boolean): FoundEntry[];Searches what gather found (see searchEntries): what first says before the rest; a typo finds, where an entry's source allows (SearchSource.fuzzy)
gather
gather(editor: EditorClient, each?: (found: FoundEntry[]) => void): Promise<FoundEntry[]>;Every entry of every source, now: those of a source that fails are left out
prefixes
prefixes(): Record<string, string>;The sources searched alone by a first character, by it
recent
recent(): readonly string[];What was used last, latest first, as source:id
remove
remove(id: string): void;Takes out the source with that id; nothing happens when there is none
run
run(entry: FoundEntry, editor: EditorClient): Promise<void>;Does what an entry does, and keeps it first among what was used last
sources
sources(): readonly SearchSource[];Where it looks, in order