import { IMatch } from '@vscode-alt/monaco-editor/esm/vs/base/common/filters'; export type Score = [number, number[]]; export type ScorerCache = { [key: string]: IItemScore; }; export declare function score(target: string, query: string, queryLower: string, fuzzy: boolean): Score; /** * Scoring on structural items that have a label and optional description. */ export interface IItemScore { /** * Overall score. */ score: number; /** * Matches within the label. */ labelMatch?: IMatch[]; /** * Matches within the description. */ descriptionMatch?: IMatch[]; } export interface IItemAccessor { /** * Just the label of the item to score on. */ getItemLabel(item: T): string | null; /** * The optional description of the item to score on. Can be null. */ getItemDescription(item: T): string | null; /** * If the item is a file, the path of the file to score on. Can be null. */ getItemPath(file: T): string | undefined; } export interface IPreparedQuery { original: string; value: string; lowercase: string; containsPathSeparator: boolean; } /** * Helper function to prepare a search value for scoring in quick open by removing unwanted characters. */ export declare function prepareQuery(original: string): IPreparedQuery; export declare function scoreItem(item: T, query: IPreparedQuery, fuzzy: boolean, accessor: IItemAccessor, cache: ScorerCache): IItemScore; export declare function compareItemsByScore(itemA: T, itemB: T, query: IPreparedQuery, fuzzy: boolean, accessor: IItemAccessor, cache: ScorerCache, fallbackComparer?: typeof fallbackCompare): number; export declare function fallbackCompare(itemA: T, itemB: T, query: IPreparedQuery, accessor: IItemAccessor): number;