mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-10 09:40:21 +08:00
add types for Ace editor completion hooks (#25337)
This commit is contained in:
31
types/ace/index.d.ts
vendored
31
types/ace/index.d.ts
vendored
@@ -3039,6 +3039,37 @@ declare namespace AceAjax {
|
||||
**/
|
||||
new(container: HTMLElement, theme?: string): VirtualRenderer;
|
||||
}
|
||||
|
||||
export interface Completer {
|
||||
/**
|
||||
* Provides possible completion results asynchronously using the given callback.
|
||||
* @param editor The editor to associate with
|
||||
* @param session The `EditSession` to refer to
|
||||
* @param pos An object containing the row and column
|
||||
* @param prefix The prefixing string before the current position
|
||||
* @param callback Function to provide the results or error
|
||||
*/
|
||||
getCompletions: (editor: Editor, session: IEditSession, pos: Position, prefix: string, callback: CompletionCallback) => void;
|
||||
|
||||
/**
|
||||
* Provides tooltip information about a completion result.
|
||||
* @param item The completion result
|
||||
*/
|
||||
getDocTooltip?: (item: Completion) => void;
|
||||
}
|
||||
|
||||
export interface Completion {
|
||||
value: string;
|
||||
meta: string;
|
||||
type?: string;
|
||||
caption?: string;
|
||||
snippet?: any;
|
||||
score?: number;
|
||||
exactMatch?: number;
|
||||
docHTML?: string;
|
||||
}
|
||||
|
||||
export type CompletionCallback = (error: Error, results: Completion[]) => void;
|
||||
}
|
||||
|
||||
declare var ace: AceAjax.Ace;
|
||||
|
||||
Reference in New Issue
Block a user