From 36d0ed0829ebb232fce804057d64510e66abe6cd Mon Sep 17 00:00:00 2001 From: mtgto Date: Sat, 11 Apr 2020 00:49:52 +0900 Subject: [PATCH] [codemirror] Add lacked arguments of runMode (#43629) --- types/codemirror/addon/runmode/runmode.d.ts | 12 ++++++------ types/codemirror/test/addon/runmode/runmode.ts | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/types/codemirror/addon/runmode/runmode.d.ts b/types/codemirror/addon/runmode/runmode.d.ts index 3f0b85ff43..05d6944bd1 100644 --- a/types/codemirror/addon/runmode/runmode.d.ts +++ b/types/codemirror/addon/runmode/runmode.d.ts @@ -12,13 +12,13 @@ declare module "codemirror" { /** * Runs a CodeMirror mode over text without opening an editor instance. * - * @param text The document to run through the highlighter. - * @param mode The mode to use (must be loaded as normal). + * @param text The document to run through the highlighter. + * @param mode The mode to use (must be loaded as normal). * @param output If this is a function, it will be called for each token with - * two arguments, the token's text and the token's style class - * (may be null for unstyled tokens). If it is a DOM node, the - * tokens will be converted to span elements as in an editor, + * five arguments, the token's text, the token's style class (may be null for unstyled tokens), + * the number of row of the token, the column position of token and the state of mode. + * If it is a DOM node, the tokens will be converted to span elements as in an editor, * and inserted into the node (through innerHTML). */ - function runMode(text: string, modespec: any, callback: (HTMLElement | ((text: string, style: string | null) => void)), options? : { tabSize?: number; state?: any; }): void; + function runMode(text: string, mode: any, callback: (HTMLElement | ((text: string, style?: string | null, row?: number, column?: number, state?: any) => void)), options? : { tabSize?: number; state?: any; }): void; } diff --git a/types/codemirror/test/addon/runmode/runmode.ts b/types/codemirror/test/addon/runmode/runmode.ts index 8e7807c9f1..5316704494 100644 --- a/types/codemirror/test/addon/runmode/runmode.ts +++ b/types/codemirror/test/addon/runmode/runmode.ts @@ -4,3 +4,4 @@ import "codemirror/addon/runmode/runmode"; const query = "SELECT * FROM Table"; CodeMirror.runMode(query, "text/x-sql", document.body); +CodeMirror.runMode(query, "text/x-sql", (text, style, row, column, state) => {});