Merge pull request #5745 from borisyankov/fix/codemirror-showhint

codemirror showhint formatting
This commit is contained in:
Basarat Ali Syed
2015-09-09 13:38:11 +10:00

View File

@@ -6,7 +6,7 @@
// See docs https://codemirror.net/doc/manual.html#addon_show-hint
declare module CodeMirror {
var commands : any;
var commands: any;
/** Provides a framework for showing autocompletion hints. Defines editor.showHint, which takes an optional
options object, and pops up a widget that allows the user to select a completion. Finding hints is done with
@@ -14,13 +14,12 @@ declare module CodeMirror {
and return a {list, from, to} object, where list is an array of strings or objects (the completions), and
from and to give the start and end of the token that is being completed as {line, ch} objects. An optional
selectedHint property (an integer) can be added to the completion object to control the initially selected hint. */
function showHint (cm: CodeMirror.Doc, hinter?: (doc : CodeMirror.Doc) => Hints, options?: ShowHintOptions) : void;
function showHint(cm: CodeMirror.Doc, hinter?: (doc: CodeMirror.Doc) => Hints, options?: ShowHintOptions): void;
interface Hints {
from: Position;
to: Position;
list: Hint[] | string[];
list: (Hint | string)[];
}
/** Interface used by showHint.js Codemirror add-on
@@ -38,8 +37,8 @@ declare module CodeMirror {
interface Editor {
/** An extension of the existing CodeMirror typings for the Editor.on("keyup", func) syntax */
on(eventName: string, handler: (doc: CodeMirror.Doc, event : any ) => void ): void;
off(eventName: string, handler: (doc: CodeMirror.Doc, event : any) => void ): void;
on(eventName: string, handler: (doc: CodeMirror.Doc, event: any) => void): void;
off(eventName: string, handler: (doc: CodeMirror.Doc, event: any) => void): void;
}
/** Extend CodeMirror.Doc with a state object, so that the Doc.state.completionActive property is reachable*/
@@ -50,7 +49,7 @@ declare module CodeMirror {
interface ShowHintOptions {
completeSingle: boolean;
hint: (doc : CodeMirror.Doc) => Hints;
hint: (doc: CodeMirror.Doc) => Hints;
}
/** The Handle used to interact with the autocomplete dialog box.*/
@@ -63,7 +62,7 @@ declare module CodeMirror {
pick(): void;
data: any;
}
interface EditorConfiguration {
showHint?: boolean;
hintOptions?: ShowHintOptions;