diff --git a/node_modules/@types/codemirror/LICENSE b/node_modules/@types/codemirror/LICENSE new file mode 100644 index 0000000000..9e841e7a26 --- /dev/null +++ b/node_modules/@types/codemirror/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/codemirror/README.md b/node_modules/@types/codemirror/README.md new file mode 100644 index 0000000000..41366db1fe --- /dev/null +++ b/node_modules/@types/codemirror/README.md @@ -0,0 +1,16 @@ +# Installation +> `npm install --save @types/codemirror` + +# Summary +This package contains type definitions for codemirror (https://github.com/marijnh/CodeMirror). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/codemirror. + +### Additional Details + * Last updated: Sun, 12 Jul 2020 08:28:44 GMT + * Dependencies: [@types/tern](https://npmjs.com/package/@types/tern) + * Global values: `CodeMirror` + +# Credits +These definitions were written by [mihailik](https://github.com/mihailik), [nrbernard](https://github.com/nrbernard), [Pr1st0n](https://github.com/Pr1st0n), [rileymiller](https://github.com/rileymiller), [toddself](https://github.com/toddself), [ysulyma](https://github.com/ysulyma), [azoson](https://github.com/azoson), [kylesferrazza](https://github.com/kylesferrazza), [fityocsaba96](https://github.com/fityocsaba96), and [koddsson](https://github.com/koddsson). diff --git a/node_modules/@types/codemirror/addon/comment/comment.d.ts b/node_modules/@types/codemirror/addon/comment/comment.d.ts new file mode 100644 index 0000000000..75981708fe --- /dev/null +++ b/node_modules/@types/codemirror/addon/comment/comment.d.ts @@ -0,0 +1,42 @@ +// Type definitions for codemirror +// Project: https://github.com/marijnh/CodeMirror +// Definitions by: Nikolaj Kappler +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// See docs https://codemirror.net/doc/manual.html#addon_comment + +// Todo: add 'toggleComment' command, once command type definitions exist in main definitions + +import * as CodeMirror from 'codemirror'; + +declare module 'codemirror' { + interface Editor { + /** Tries to uncomment the current selection, and if that fails, line-comments it. */ + toggleComment(options?: CommentOptions): void; + /** Set the lines in the given range to be line comments. Will fall back to `blockComment` when no line comment style is defined for the mode. */ + lineComment(from: Position, to: Position, options?: CommentOptions): void; + /** Wrap the code in the given range in a block comment. Will fall back to `lineComment` when no block comment style is defined for the mode. */ + blockComment(from: Position, to: Position, options?: CommentOptions): void; + /** Try to uncomment the given range. Returns `true` if a comment range was found and removed, `false` otherwise. */ + uncomment(from: Position, to: Position, options?: CommentOptions): boolean; + } + + interface CommentOptions { + /** Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings. */ + blockCommentStart?: string; + /** Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings. */ + blockCommentEnd?: string; + /** Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings. */ + blockCommentLead?: string; + /** Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings. */ + lineComment?: string; + /** A string that will be inserted after opening and leading markers, and before closing comment markers. Defaults to a single space. */ + padding?: string; + /** Whether, when adding line comments, to also comment lines that contain only whitespace. */ + commentBlankLines?: boolean; + /** When adding line comments and this is turned on, it will align the comment block to the current indentation of the first line of the block. */ + indent?: boolean; + /** When block commenting, this controls whether the whole lines are indented, or only the precise range that is given. Defaults to `true`. */ + fullLines?: boolean; + } +} diff --git a/node_modules/@types/codemirror/addon/display/autorefresh.d.ts b/node_modules/@types/codemirror/addon/display/autorefresh.d.ts new file mode 100644 index 0000000000..f2f865feac --- /dev/null +++ b/node_modules/@types/codemirror/addon/display/autorefresh.d.ts @@ -0,0 +1,16 @@ +// Type definitions for CodeMirror +// Project: https://github.com/marijnh/CodeMirror +// Definitions by: mtgto +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// See docs https://codemirror.net/doc/manual.html#addon_autorefresh + +import * as CodeMirror from 'codemirror'; + +declare module 'codemirror' { + interface EditorConfiguration { + // if true, it will be refreshed the first time the editor becomes visible. + // you can pass delay (msec) time as polling duration + autoRefresh?: boolean | { delay: number }; + } +} diff --git a/node_modules/@types/codemirror/addon/display/panel.d.ts b/node_modules/@types/codemirror/addon/display/panel.d.ts new file mode 100644 index 0000000000..df0617fdbd --- /dev/null +++ b/node_modules/@types/codemirror/addon/display/panel.d.ts @@ -0,0 +1,45 @@ +// Type definitions for codemirror +// Project: https://github.com/marijnh/CodeMirror +// Definitions by: Nikolaj Kappler +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// See docs https://codemirror.net/doc/manual.html#addon_panel + +import * as CodeMirror from 'codemirror'; + +declare module 'codemirror' { + interface Panel { + /**Removes the panel from the editor */ + clear(): void; + /**Notifies panel that height of DOM node has changed */ + changed(height?: number): void; + } + + interface ShowPanelOptions { + /**Controls the position of the newly added panel. The following values are recognized: + * `top` (default): Adds the panel at the very top. + * `after-top`: Adds the panel at the bottom of the top panels. + * `bottom`: Adds the panel at the very bottom. + * `before-bottom`: Adds the panel at the top of the bottom panels. + */ + position?: 'top' | 'after-top' | 'bottom' | 'before-bottom'; + /**The new panel will be added before the given panel. */ + before?: Panel; + /**The new panel will be added after the given panel. */ + after?: Panel; + /**The new panel will replace the given panel. */ + replace?: Panel; + /**Whether to scroll the editor to keep the text's vertical position stable, when adding a panel above it. Defaults to false. */ + stable?: boolean; + } + + interface Editor { + /** + * Places a DOM node above or below an editor and shrinks the editor to make room for the node. + * When using the `after`, `before` or `replace` options, if the panel doesn't exists or has been removed, the value of the `position` option will be used as a fallback. + * @param node the DOM node + * @param options optional options object + */ + addPanel(node: HTMLElement, options?: ShowPanelOptions): Panel; + } +} diff --git a/node_modules/@types/codemirror/addon/display/placeholder.d.ts b/node_modules/@types/codemirror/addon/display/placeholder.d.ts new file mode 100644 index 0000000000..f5f134fe67 --- /dev/null +++ b/node_modules/@types/codemirror/addon/display/placeholder.d.ts @@ -0,0 +1,18 @@ +// Type definitions for codemirror +// Project: https://github.com/codemirror/CodeMirror +// Definitions by: ficristo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// See docs https://codemirror.net/doc/manual.html#addon_placeholder + +import * as CodeMirror from 'codemirror'; + +declare module 'codemirror' { + interface EditorConfiguration { + /** + * Adds a placeholder option that can be used to make content appear in the editor when it is empty and not focused. + * It can hold either a string or a DOM node. Also gives the editor a CodeMirror-empty CSS class whenever it doesn't contain any text. + */ + placeholder?: string; + } +} diff --git a/node_modules/@types/codemirror/addon/edit/closebrackets.d.ts b/node_modules/@types/codemirror/addon/edit/closebrackets.d.ts new file mode 100644 index 0000000000..f0938f739d --- /dev/null +++ b/node_modules/@types/codemirror/addon/edit/closebrackets.d.ts @@ -0,0 +1,47 @@ +// Type definitions for codemirror +// Project: https://github.com/codemirror/CodeMirror +// Definitions by: ficristo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// See docs https://codemirror.net/doc/manual.html#addon_closebrackets + +import * as CodeMirror from 'codemirror'; + +declare module 'codemirror' { + interface AutoCloseBrackets { + /** + * String containing pairs of matching characters. + */ + pairs?: string; + + /** + * If the next character is in the string, opening a bracket should be auto-closed. + */ + closeBefore?: string; + + /** + * String containing chars that could do a triple quote. + */ + triples?: string; + + /** + * explode should be a similar string that gives the pairs of characters that, when enter is pressed between them, should have the second character also moved to its own line. + */ + explode?: string; + + /** + * By default, if the active mode has a closeBrackets property, that overrides the configuration given in the option. + * But you can add an override property with a truthy value to override mode-specific configuration. + */ + override?: boolean; + } + + interface EditorConfiguration { + /** + * Will auto-close brackets and quotes when typed. + * By default, it'll auto-close ()[]{}''"", but you can pass it a string similar to that (containing pairs of matching characters), + * or an object with pairs and optionally explode properties to customize it. + */ + autoCloseBrackets?: AutoCloseBrackets | boolean | string; + } +} diff --git a/node_modules/@types/codemirror/addon/edit/closetag.d.ts b/node_modules/@types/codemirror/addon/edit/closetag.d.ts new file mode 100644 index 0000000000..3119995c37 --- /dev/null +++ b/node_modules/@types/codemirror/addon/edit/closetag.d.ts @@ -0,0 +1,51 @@ +// Type definitions for codemirror +// Project: https://github.com/codemirror/CodeMirror +// Definitions by: ficristo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// See docs https://codemirror.net/doc/manual.html#addon_closetag + +import * as CodeMirror from 'codemirror'; + +declare module 'codemirror' { + interface CommandActions { + closeTag(cm: CodeMirror.Editor): void; + } + + interface AutoCloseTags { + /** + * Whether to autoclose when the '/' of a closing tag is typed. (default true) + */ + whenClosing?: boolean; + + /** + * Whether to autoclose the tag when the final '>' of an opening tag is typed. (default true) + */ + whenOpening?: boolean; + + /** + * An array of tag names that should not be autoclosed. (default is empty tags for HTML, none for XML) + */ + dontCloseTags?: Array; + + /** + * An array of tag names that should, when opened, cause a + * blank line to be added inside the tag, and the blank line and + * closing line to be indented. (default is block tags for HTML, none for XML) + */ + indentTags?: Array; + + /** + * An array of XML tag names that should be autoclosed with '/>'. (default is none) + */ + emptyTags: Array; + } + + interface EditorConfiguration { + /** + * Will auto-close XML tags when '>' or '/' is typed. + * Depends on the fold/xml-fold.js addon. + */ + autoCloseTags?: AutoCloseTags | boolean; + } +} diff --git a/node_modules/@types/codemirror/addon/edit/matchbrackets.d.ts b/node_modules/@types/codemirror/addon/edit/matchbrackets.d.ts new file mode 100644 index 0000000000..3694b866dd --- /dev/null +++ b/node_modules/@types/codemirror/addon/edit/matchbrackets.d.ts @@ -0,0 +1,42 @@ +// Type definitions for codemirror +// Project: https://github.com/marijnh/CodeMirror +// Definitions by: Sixin Li +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// See docs https://codemirror.net/doc/manual.html#addon_matchbrackets + +import * as CodeMirror from 'codemirror'; + +declare module 'codemirror' { + interface MatchBrackets { + /** + * Only use the character after the start position, never the one before it. + */ + afterCursor?: boolean; + + /** + * Causes only matches where both brackets are at the same side of the start position to be considered. + */ + strict?: boolean; + + /** + * Stop after scanning this amount of lines without a successful match. Defaults to 1000. + */ + maxScanLines?: number; + + /** + * Ignore lines longer than this. Defaults to 10000. + */ + maxScanLineLength?: number; + + /** + * Don't highlight a bracket in a line longer than this. Defaults to 1000. + */ + maxHighlightLineLength?: number; + } + + interface EditorConfiguration { + // When set to true or an options object, causes matching brackets to be highlighted whenever the cursor is next to them. + matchBrackets?: MatchBrackets | boolean; + } +} diff --git a/node_modules/@types/codemirror/addon/edit/matchtags.d.ts b/node_modules/@types/codemirror/addon/edit/matchtags.d.ts new file mode 100644 index 0000000000..378418fb23 --- /dev/null +++ b/node_modules/@types/codemirror/addon/edit/matchtags.d.ts @@ -0,0 +1,32 @@ +// Type definitions for codemirror +// Project: https://github.com/codemirror/CodeMirror +// Definitions by: ficristo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// See docs https://codemirror.net/doc/manual.html#addon_matchtags + +import * as CodeMirror from 'codemirror'; + +declare module 'codemirror' { + interface CommandActions { + /** + * You can bind a key to in order to jump to the tag matching the one under the cursor. + */ + toMatchingTag(cm: CodeMirror.Editor): void; + } + + interface MatchTags { + /** + * Highlight both matching tags. + */ + bothTags?: boolean; + } + + interface EditorConfiguration { + /** + * When enabled will cause the tags around the cursor to be highlighted (using the CodeMirror-matchingtag class). + * Depends on the addon/fold/xml-fold.js addon. + */ + matchTags?: MatchTags | boolean; + } +} diff --git a/node_modules/@types/codemirror/addon/hint/show-hint.d.ts b/node_modules/@types/codemirror/addon/hint/show-hint.d.ts new file mode 100644 index 0000000000..076f77b38f --- /dev/null +++ b/node_modules/@types/codemirror/addon/hint/show-hint.d.ts @@ -0,0 +1,83 @@ +// Type definitions for codemirror +// Project: https://github.com/marijnh/CodeMirror +// Definitions by: jacqt +// basarat +// mbilsing +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// See docs https://codemirror.net/doc/manual.html#addon_show-hint + +import * as CodeMirror from 'codemirror'; + +declare module 'codemirror' { + /** 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 + a hinting functions (the hint option), which is a function that take an editor instance and options object, + 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.Editor, hinter?: HintFunction, options?: ShowHintOptions): void; + + interface Hints { + from: Position; + to: Position; + list: (Hint | string)[]; + } + + /** Interface used by showHint.js Codemirror add-on + When completions aren't simple strings, they should be objects with the following properties: */ + interface Hint { + text: string; + className?: string; + displayText?: string; + from?: Position; + /** Called if a completion is picked. If provided *you* are responsible for applying the completion */ + hint?: (cm: CodeMirror.Editor, data: Hints, cur: Hint) => void; + render?: (element: HTMLLIElement, data: Hints, cur: Hint) => void; + to?: Position; + } + + 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; + showHint: (options: ShowHintOptions) => void; + } + + interface HintFunction { + (cm: CodeMirror.Editor): Hints; + } + + interface AsyncHintFunction { + (cm: CodeMirror.Editor, callback: (hints: Hints) => any): any; + async?: boolean; + } + + interface ShowHintOptions { + completeSingle?: boolean; + hint: HintFunction | AsyncHintFunction; + alignWithWord?: boolean; + closeCharacters?: RegExp; + closeOnUnfocus?: boolean; + completeOnSingleClick?: boolean; + container?: HTMLElement | null; + customKeys?: { [key: string]: ((editor: Editor, handle: Handle) => void) | string } | null; + extraKeys?: { [key: string]: ((editor: Editor, handle: Handle) => void) | string } | null; + } + + /** The Handle used to interact with the autocomplete dialog box.*/ + interface Handle { + moveFocus(n: number, avoidWrap: boolean): void; + setFocus(n: number): void; + menuSize(): number; + length: number; + close(): void; + pick(): void; + data: any; + } + + interface EditorConfiguration { + showHint?: boolean; + hintOptions?: ShowHintOptions; + } +} diff --git a/node_modules/@types/codemirror/addon/merge/merge.d.ts b/node_modules/@types/codemirror/addon/merge/merge.d.ts new file mode 100644 index 0000000000..ae35d7a1ad --- /dev/null +++ b/node_modules/@types/codemirror/addon/merge/merge.d.ts @@ -0,0 +1,18 @@ +// Type definitions for codemirror +// Project: https://github.com/codemirror/CodeMirror +// Definitions by: Andrew Ritchie +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// See docs https://github.com/codemirror/CodeMirror/blob/master/addon/merge/merge.js + +import * as CodeMirror from 'codemirror'; + +declare module 'codemirror' { + interface CommandActions { + /** Move cursor to the next diff */ + goNextDiff(cm: CodeMirror.Editor): void; + + /** Move cursor to the previous diff */ + goPrevDiff(cm: CodeMirror.Editor): void; + } +} diff --git a/node_modules/@types/codemirror/addon/runmode/runmode.d.ts b/node_modules/@types/codemirror/addon/runmode/runmode.d.ts new file mode 100644 index 0000000000..8acba910a7 --- /dev/null +++ b/node_modules/@types/codemirror/addon/runmode/runmode.d.ts @@ -0,0 +1,30 @@ +// Type definitions for codemirror +// Project: https://github.com/marijnh/CodeMirror +// Definitions by: Joseph Vaughan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// See docs https://codemirror.net/doc/manual.html#addon_runmode + +import * as CodeMirror from 'codemirror'; + +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 output If this is a function, it will be called for each token with + * 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, + 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/node_modules/@types/codemirror/addon/scroll/scrollpastend.d.ts b/node_modules/@types/codemirror/addon/scroll/scrollpastend.d.ts new file mode 100644 index 0000000000..672c001dee --- /dev/null +++ b/node_modules/@types/codemirror/addon/scroll/scrollpastend.d.ts @@ -0,0 +1,17 @@ +// Type definitions for codemirror +// Project: https://github.com/codemirror/CodeMirror +// Definitions by: ficristo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// See docs https://github.com/codemirror/CodeMirror/blob/master/addon/scroll/scrollpastend.js + +import * as CodeMirror from 'codemirror'; + +declare module 'codemirror' { + interface EditorConfiguration { + /** + * When the end of the file is reached it allows you to keep scrolling so that your last few lines of code are not stuck at the bottom of the editor. + */ + scrollPastEnd?: boolean; + } +} diff --git a/node_modules/@types/codemirror/addon/search/match-highlighter.d.ts b/node_modules/@types/codemirror/addon/search/match-highlighter.d.ts new file mode 100644 index 0000000000..7fe8fc4e1b --- /dev/null +++ b/node_modules/@types/codemirror/addon/search/match-highlighter.d.ts @@ -0,0 +1,55 @@ +// Type definitions for codemirror +// Project: https://github.com/codemirror/CodeMirror +// Definitions by: ficristo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// See docs https://codemirror.net/doc/manual.html#addon_match-highlighter + +import * as CodeMirror from 'codemirror'; + +declare module 'codemirror' { + interface HighlightSelectionMatches { + /** + * Minimum amount of selected characters that triggers a highlight (default 2). + */ + minChars?: number; + + /** + * The style to be used to highlight the matches (default "matchhighlight", which will correspond to CSS class cm-matchhighlight). + */ + style?: string; + + /** + * Controls whether whitespace is trimmed from the selection. + */ + trim?: boolean; + + /** + * Can be set to true or to a regexp matching the characters that make up a word. + */ + showToken?: boolean | RegExp; + + /** + * Used to specify how much time to wait, in milliseconds, before highlighting the matches (default is 100). + */ + delay?: number, + + /** + * If wordsOnly is enabled, the matches will be highlighted only if the selected text is a word. + */ + wordsOnly?: boolean; + + /** + * If annotateScrollbar is enabled, the occurences will be highlighted on the scrollbar via the matchesonscrollbar addon. + */ + annotateScrollbar?: boolean; + } + + interface EditorConfiguration { + /** + * Adds a highlightSelectionMatches option that can be enabled to highlight all instances of a currently selected word. + * When enabled, it causes the current word to be highlighted when nothing is selected (defaults to off). + */ + highlightSelectionMatches?: HighlightSelectionMatches | boolean; + } +} diff --git a/node_modules/@types/codemirror/addon/search/searchcursor.d.ts b/node_modules/@types/codemirror/addon/search/searchcursor.d.ts new file mode 100644 index 0000000000..c8906b137a --- /dev/null +++ b/node_modules/@types/codemirror/addon/search/searchcursor.d.ts @@ -0,0 +1,46 @@ +// Type definitions for codemirror +// Project: https://github.com/marijnh/CodeMirror +// Definitions by: jacqt +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as CodeMirror from 'codemirror'; + +declare module 'codemirror' { + interface Doc { + /** This method can be used to implement search/replace functionality. + * `query`: This can be a regular * expression or a string (only strings will match across lines - + * if they contain newlines). + * `start`: This provides the starting position of the search. It can be a `{line, ch} object, + * or can be left off to default to the start of the document + * `caseFold`: This is only relevant when matching a string. IT will cause the search to be case-insenstive */ + getSearchCursor(query: string | RegExp, start?: Position, caseFold?: boolean): SearchCursor; + } + + interface SearchCursor { + /** Searches forward or backward from the current position. The return value indicates whether a match was + * found. If matching a regular expression, the return value will be the array returned by the match method, in case + * you want to extract matched groups */ + find(reverse: boolean): boolean | any[]; + + /** Searches forward from the current position. The return value indicates whether a match was + * found. If matching a regular expression, the return value will be the array returned by the match method, in case + * you want to extract matched groups */ + findNext(): boolean | any[]; + + /** Searches backward from the current position. The return value indicates whether a match was + * found. If matching a regular expression, the return value will be the array returned by the match method, in case + * you want to extract matched groups */ + findPrevious(): boolean | any[]; + + /** Only valid when the last call to find, findNext, or findPrevious did not return false. Returns {line, ch} + * objects pointing the start of the match. */ + from(): Position; + + /** Only valid when the last call to find, findNext, or findPrevious did not return false. Returns {line, ch} + * objects pointing the end of the match. */ + to(): Position; + + /** Replaces the currently found match with the given text and adjusts the cursor position to reflect the deplacement. */ + replace(text: string, origin?: string): void; + } +} diff --git a/node_modules/@types/codemirror/addon/selection/active-line.d.ts b/node_modules/@types/codemirror/addon/selection/active-line.d.ts new file mode 100644 index 0000000000..a843b09dce --- /dev/null +++ b/node_modules/@types/codemirror/addon/selection/active-line.d.ts @@ -0,0 +1,25 @@ +// Type definitions for codemirror +// Project: https://github.com/codemirror/CodeMirror +// Definitions by: ficristo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// See docs https://codemirror.net/doc/manual.html#active-line + +import * as CodeMirror from 'codemirror'; + +declare module 'codemirror' { + interface StyleActiveLine { + /** + * Controls whether single-line selections, or just cursor selections, are styled. Defaults to false (only cursor selections). + */ + nonEmpty: boolean; + } + + interface EditorConfiguration { + /** + * When enabled gives the wrapper of the line that contains the cursor the class CodeMirror-activeline, + * adds a background with the class CodeMirror-activeline-background, and adds the class CodeMirror-activeline-gutter to the line's gutter space is enabled. + */ + styleActiveLine?: StyleActiveLine | boolean; + } +} diff --git a/node_modules/@types/codemirror/addon/tern/tern.d.ts b/node_modules/@types/codemirror/addon/tern/tern.d.ts new file mode 100644 index 0000000000..de2822fedd --- /dev/null +++ b/node_modules/@types/codemirror/addon/tern/tern.d.ts @@ -0,0 +1,113 @@ +// Type definitions for codemirror +// Project: https://github.com/marijnh/CodeMirror +// Definitions by: Nikolaj Kappler +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// See docs https://codemirror.net/doc/manual.html#addon_tern and https://codemirror.net/addon/tern/tern.js (comments in the beginning of the file) +// Docs for tern itself might also be helpful: http://ternjs.net/doc/manual.html + +import * as CodeMirror from 'codemirror'; +import * as Tern from 'tern'; + +declare module 'codemirror' { + interface TernServer { + readonly options: TernOptions; + readonly docs: { + readonly [key: string]: { + doc: CodeMirror.Doc; + name: string; + changed?: { + from: CodeMirror.Position | number; + to: CodeMirror.Position | number; + }; + }; + }; + readonly server: Tern.Server; + addDoc( + name: string, + doc: CodeMirror.Doc, + ): { doc: CodeMirror.Doc; name: string; changed: { from: number; to: number } | null }; + delDoc(id: string | CodeMirror.Editor | CodeMirror.Doc): void; + hideDoc(id: string | CodeMirror.Editor | CodeMirror.Doc): void; + complete(cm: CodeMirror.Doc): void; + showType(cm: CodeMirror.Doc, pos?: CodeMirror.Position | number, callback?: Function): void; + showDocs(cm: CodeMirror.Doc, pos?: CodeMirror.Position | number, callback?: Function): void; + updateArgHints(cm: CodeMirror.Doc): void; + jumpToDef(cm: CodeMirror.Doc): void; + jumpBack(cm: CodeMirror.Doc): void; + rename(cm: CodeMirror.Doc): void; + selectName(cm: CodeMirror.Doc): void; + request( + cm: CodeMirror.Doc, + query: Q, + callback: (error?: Error, data?: Tern.QueryRegistry[Q['type']]['result']) => void, + pos?: CodeMirror.Position, + ): void; + request( + cm: CodeMirror.Doc, + query: Q, + callback: (error?: Error, data?: Tern.QueryRegistry[Q]['result']) => void, + pos?: CodeMirror.Position, + ): void; + destroy(): void; + } + + interface TernConstructor { + new (options?: TernOptions): TernServer; + } + export const TernServer: TernConstructor; + + interface TernOptions { + /** An object mapping plugin names to configuration options. */ + plugins?: Tern.ConstructorOptions['plugins']; + /** An array of JSON definition data structures. */ + defs?: Tern.Def[]; + /** + * Can be used to access files in + * the project that haven't been loaded yet. Simply do callback(null) to + * indicate that a file is not available. + */ + getFile?(name: string, callback: (doc: CodeMirror.Doc | null) => any): any; + /** + * This function will be applied + * to documents before passing them on to Tern. + */ + fileFilter?(value: string, docName: string, doc: CodeMirror.Doc): string; + /** This function should, when providing a multi-file view, switch the view or focus to the named file. */ + switchToDoc?(name: string, doc: CodeMirror.Doc): any; + /** Can be used to override the way errors are displayed. */ + showError?(editor: CodeMirror.Editor, message: Error): any; + /** + * Customize the content in tooltips for completions. + * Is passed a single argument — the completion's data as returned by + * Tern — and may return a string, DOM node, or null to indicate that + * no tip should be shown. By default the docstring is shown. + */ + completionTip?(data: Tern.CompletionsQueryResult): string | HTMLElement | null; + /** Like completionTip, but for the tooltips shown for type queries. */ + typeTip?(data: Tern.TypeQueryResult): string | HTMLElement | null; + /** This function will be applied to the Tern responses before treating them */ + responseFilter?( + doc: CodeMirror.Doc, + query: Tern.Query, + request: Tern.Document, + error: Error | undefined, + data: Tern.QueryRegistry[Tern.Query['type']]['result'] | undefined, + ): any; + /** + * Set to true to enable web worker mode. You'll probably + * want to feature detect the actual value you use here, for example + * !!window.Worker. + */ + useWorker?: boolean; + /** The main script of the worker. Point this to wherever you are hosting worker.js from this directory. */ + workerScript?: string; + /** + * An array of paths pointing (relative to workerScript) + * to the Acorn and Tern libraries and any Tern plugins you want to + * load. Or, if you minified those into a single script and included + * them in the workerScript, simply leave this undefined. + */ + workerDeps?: string[]; + } +} diff --git a/node_modules/@types/codemirror/index.d.ts b/node_modules/@types/codemirror/index.d.ts new file mode 100644 index 0000000000..7eeed6c7c9 --- /dev/null +++ b/node_modules/@types/codemirror/index.d.ts @@ -0,0 +1,1855 @@ +// Type definitions for codemirror +// Project: https://github.com/marijnh/CodeMirror +// Definitions by: mihailik +// nrbernard +// Pr1st0n +// rileymiller +// toddself +// ysulyma +// azoson +// kylesferrazza +// fityocsaba96 +// koddsson +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.2 + +export = CodeMirror; +export as namespace CodeMirror; + +declare function CodeMirror(host: HTMLElement, options?: CodeMirror.EditorConfiguration): CodeMirror.Editor; +declare function CodeMirror( + callback: (host: HTMLElement) => void, + options?: CodeMirror.EditorConfiguration, +): CodeMirror.Editor; + +declare namespace CodeMirror { + export var Doc: CodeMirror.DocConstructor; + export var Pos: CodeMirror.PositionConstructor; + export var StringStream: CodeMirror.StringStreamConstructor; + export var Pass: { toString(): 'CodeMirror.PASS' }; + + /** Find the column position at a given string index using a given tabsize. */ + function countColumn(line: string, index: number | null, tabSize: number): number; + function fromTextArea(host: HTMLTextAreaElement, options?: EditorConfiguration): CodeMirror.EditorFromTextArea; + + /** Split a string by new line. */ + function splitLines(text: string): Array; + + /** Check if a char is part of an alphabet. */ + function isWordChar(ch: string): boolean; + + /** Call startState of the mode if available, otherwise return true */ + function startState(mode: CodeMirror.Mode, a1?: any, a2?: any): any | boolean; + + /** Compare two positions, return 0 if they are the same, a negative number when a is less, and a positive number otherwise. */ + function cmpPos(a: Position, b: Position): number; + + /** Utility function that computes an end position from a change (an object with from, to, and text properties, as passed to various event handlers). + The returned position will be the end of the changed range, after the change is applied. */ + function changeEnd(change: EditorChange): Position; + + /** It contains a string that indicates the version of the library. This is a triple of integers "major.minor.patch", + where patch is zero for releases, and something else (usually one) for dev snapshots. */ + var version: string; + + /** An object containing default values for all options. + You can assign to its properties to modify defaults (though this won't affect editors that have already been created). */ + var defaults: any; + + /** If you want to define extra methods in terms of the CodeMirror API, it is possible to use defineExtension. + This will cause the given value(usually a method) to be added to all CodeMirror instances created from then on. */ + function defineExtension(name: string, value: any): void; + + /** Like defineExtension, but the method will be added to the interface for Doc objects instead. */ + function defineDocExtension(name: string, value: any): void; + + /** Similarly, defineOption can be used to define new options for CodeMirror. + The updateFunc will be called with the editor instance and the new value when an editor is initialized, + and whenever the option is modified through setOption. */ + function defineOption(name: string, default_: any, updateFunc: Function): void; + + /** If your extention just needs to run some code whenever a CodeMirror instance is initialized, use CodeMirror.defineInitHook. + Give it a function as its only argument, and from then on, that function will be called (with the instance as argument) + whenever a new CodeMirror instance is initialized. */ + function defineInitHook(func: Function): void; + + /** Registers a helper value with the given name in the given namespace (type). This is used to define functionality + that may be looked up by mode. Will create (if it doesn't already exist) a property on the CodeMirror object for + the given type, pointing to an object that maps names to values. I.e. after doing + CodeMirror.registerHelper("hint", "foo", myFoo), the value CodeMirror.hint.foo will point to myFoo. */ + function registerHelper(namespace: string, name: string, helper: any): void; + + /** Given a state object, returns a {state, mode} object with the inner mode and its state for the current position. */ + function innerMode(mode: Mode, state: any): { state: any; mode: Mode }; + + /** Sometimes, it is useful to add or override mode object properties from external code. + The CodeMirror.extendMode function can be used to add properties to mode objects produced for a specific mode. + Its first argument is the name of the mode, its second an object that specifies the properties that should be added. + This is mostly useful to add utilities that can later be looked up through getMode. */ + function extendMode(name: string, properties: Mode): void; + + function on(element: any, eventName: string, handler: Function): void; + function off(element: any, eventName: string, handler: Function): void; + + /** Fired whenever a change occurs to the document. changeObj has a similar type as the object passed to the editor's "change" event, + but it never has a next property, because document change events are not batched (whereas editor change events are). */ + function on(doc: Doc, eventName: 'change', handler: (instance: Doc, changeObj: EditorChange) => void): void; + function off(doc: Doc, eventName: 'change', handler: (instance: Doc, changeObj: EditorChange) => void): void; + + /** See the description of the same event on editor instances. */ + function on( + doc: Doc, + eventName: 'beforeChange', + handler: (instance: Doc, change: EditorChangeCancellable) => void, + ): void; + function off( + doc: Doc, + eventName: 'beforeChange', + handler: (instance: Doc, change: EditorChangeCancellable) => void, + ): void; + + /** Fired whenever the cursor or selection in this document changes. */ + function on(doc: Doc, eventName: 'cursorActivity', handler: (instance: CodeMirror.Editor) => void): void; + function off(doc: Doc, eventName: 'cursorActivity', handler: (instance: CodeMirror.Editor) => void): void; + + /** Equivalent to the event by the same name as fired on editor instances. */ + function on(doc: Doc, eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, obj: EditorSelectionChange) => void ): void; + function off(doc: Doc, eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, obj: EditorSelectionChange) => void ): void; + + /** Will be fired when the line object is deleted. A line object is associated with the start of the line. + Mostly useful when you need to find out when your gutter markers on a given line are removed. */ + function on(line: LineHandle, eventName: 'delete', handler: () => void): void; + function off(line: LineHandle, eventName: 'delete', handler: () => void): void; + + /** Fires when the line's text content is changed in any way (but the line is not deleted outright). + The change object is similar to the one passed to change event on the editor object. */ + function on( + line: LineHandle, + eventName: 'change', + handler: (line: LineHandle, changeObj: EditorChange) => void, + ): void; + function off( + line: LineHandle, + eventName: 'change', + handler: (line: LineHandle, changeObj: EditorChange) => void, + ): void; + + /** Fired when the cursor enters the marked range. From this event handler, the editor state may be inspected but not modified, + with the exception that the range on which the event fires may be cleared. */ + function on(marker: TextMarker, eventName: 'beforeCursorEnter', handler: () => void): void; + function off(marker: TextMarker, eventName: 'beforeCursorEnter', handler: () => void): void; + + /** Fired when the range is cleared, either through cursor movement in combination with clearOnEnter or through a call to its clear() method. + Will only be fired once per handle. Note that deleting the range through text editing does not fire this event, + because an undo action might bring the range back into existence. */ + function on(marker: TextMarker, eventName: 'clear', handler: () => void): void; + function off(marker: TextMarker, eventName: 'clear', handler: () => void): void; + + /** Fired when the last part of the marker is removed from the document by editing operations. */ + function on(marker: TextMarker, eventName: 'hide', handler: () => void): void; + function off(marker: TextMarker, eventName: 'hide', handler: () => void): void; + + /** Fired when, after the marker was removed by editing, a undo operation brought the marker back. */ + function on(marker: TextMarker, eventName: 'unhide', handler: () => void): void; + function off(marker: TextMarker, eventName: 'unhide', handler: () => void): void; + + /** Fired whenever the editor re-adds the widget to the DOM. This will happen once right after the widget is added (if it is scrolled into view), + and then again whenever it is scrolled out of view and back in again, or when changes to the editor options + or the line the widget is on require the widget to be redrawn. */ + function on(line: LineWidget, eventName: 'redraw', handler: () => void): void; + function off(line: LineWidget, eventName: 'redraw', handler: () => void): void; + + /** Various CodeMirror-related objects emit events, which allow client code to react to various situations. + Handlers for such events can be registered with the on and off methods on the objects that the event fires on. + To fire your own events, use CodeMirror.signal(target, name, args...), where target is a non-DOM-node object. */ + function signal(target: any, name: string, ...args: any[]): void; + + /** Modify a keymap to normalize modifier order and properly recognize multi-stroke bindings. */ + function normalizeKeyMap(km: KeyMap): KeyMap; + + type DOMEvent = + | 'mousedown' + | 'dblclick' + | 'touchstart' + | 'contextmenu' + | 'keydown' + | 'keypress' + | 'keyup' + | 'cut' + | 'copy' + | 'paste' + | 'dragstart' + | 'dragenter' + | 'dragover' + | 'dragleave' + | 'drop'; + + type CoordsMode = 'window' | 'page' | 'local' | 'div'; + + interface Token { + /** The character(on the given line) at which the token starts. */ + start: number; + /** The character at which the token ends. */ + end: number; + /** The token's string. */ + string: string; + /** The token type the mode assigned to the token, such as "keyword" or "comment" (may also be null). */ + type: string | null; + /** The mode's state at the end of this token. */ + state: any; + } + + interface KeyMap { + [keyName: string]: false | string | ((instance: Editor) => void | typeof Pass); + } + + /** Methods prefixed with doc. can, unless otherwise specified, be called both on CodeMirror (editor) instances and + CodeMirror.Doc instances. Thus, the Editor interface extends Doc. **/ + interface Editor extends Doc { + /** Tells you whether the editor currently has focus. */ + hasFocus(): boolean; + + /** Used to find the target position for horizontal cursor motion.start is a { line , ch } object, + amount an integer(may be negative), and unit one of the string "char", "column", or "word". + Will return a position that is produced by moving amount times the distance specified by unit. + When visually is true , motion in right - to - left text will be visual rather than logical. + When the motion was clipped by hitting the end or start of the document, the returned value will have a hitSide property set to true. */ + findPosH( + start: CodeMirror.Position, + amount: number, + unit: string, + visually: boolean, + ): { line: number; ch: number; hitSide?: boolean }; + + /** Similar to findPosH , but used for vertical motion.unit may be "line" or "page". + The other arguments and the returned value have the same interpretation as they have in findPosH. */ + findPosV( + start: CodeMirror.Position, + amount: number, + unit: string, + ): { line: number; ch: number; hitSide?: boolean }; + + /** Returns the start and end of the 'word' (the stretch of letters, whitespace, or punctuation) at the given position. */ + findWordAt(pos: CodeMirror.Position): CodeMirror.Range; + + /** Change the configuration of the editor. option should the name of an option, and value should be a valid value for that option. */ + setOption(option: K, value: EditorConfiguration[K]): void; + + /** Retrieves the current value of the given option for this editor instance. */ + getOption(option: K): EditorConfiguration[K]; + + /** Attach an additional keymap to the editor. + This is mostly useful for add - ons that need to register some key handlers without trampling on the extraKeys option. + Maps added in this way have a higher precedence than the extraKeys and keyMap options, and between them, + the maps added earlier have a lower precedence than those added later, unless the bottom argument was passed, + in which case they end up below other keymaps added with this method. */ + addKeyMap(map: string | KeyMap, bottom?: boolean): void; + + /** Disable a keymap added with addKeyMap.Either pass in the keymap object itself , or a string, + which will be compared against the name property of the active keymaps. */ + removeKeyMap(map: string | KeyMap): void; + + /** Enable a highlighting overlay.This is a stateless mini - mode that can be used to add extra highlighting. + For example, the search add - on uses it to highlight the term that's currently being searched. + mode can be a mode spec or a mode object (an object with a token method). The options parameter is optional. If given, it should be an object. + Currently, only the opaque option is recognized. This defaults to off, but can be given to allow the overlay styling, when not null, + to override the styling of the base mode entirely, instead of the two being applied together. */ + addOverlay(mode: any, options?: any): void; + + /** Pass this the exact argument passed for the mode parameter to addOverlay to remove an overlay again. */ + removeOverlay(mode: any): void; + + /** Retrieve the currently active document from an editor. */ + getDoc(): CodeMirror.Doc; + + /** Attach a new document to the editor. Returns the old document, which is now no longer associated with an editor. */ + swapDoc(doc: CodeMirror.Doc): CodeMirror.Doc; + + /** Get the content of the current editor document. You can pass it an optional argument to specify the string to be used to separate lines (defaults to "\n"). */ + getValue(seperator?: string): string; + + /** Set the content of the current editor document. */ + setValue(content: string): void; + + /** start is a an optional string indicating which end of the selection to return. + It may be "from", "to", "head" (the side of the selection that moves when you press shift+arrow), + or "anchor" (the fixed side of the selection).Omitting the argument is the same as passing "head". A {line, ch} object will be returned. **/ + getCursor(start?: string): CodeMirror.Position; + + /** Set the cursor position. You can either pass a single {line, ch} object, or the line and the character as two separate parameters. + Will replace all selections with a single, empty selection at the given position. + The supported options are the same as for setSelection */ + setCursor( + pos: CodeMirror.Position | number, + ch?: number, + options?: { bias?: number; origin?: string; scroll?: boolean }, + ): void; + + /** Sets the gutter marker for the given gutter (identified by its CSS class, see the gutters option) to the given value. + Value can be either null, to clear the marker, or a DOM element, to set it. The DOM element will be shown in the specified gutter next to the specified line. */ + setGutterMarker(line: any, gutterID: string, value: HTMLElement | null): CodeMirror.LineHandle; + + /** Remove all gutter markers in the gutter with the given ID. */ + clearGutter(gutterID: string): void; + + /** Set a CSS class name for the given line.line can be a number or a line handle. + where determines to which element this class should be applied, can can be one of "text" (the text element, which lies in front of the selection), + "background"(a background element that will be behind the selection), + or "wrap" (the wrapper node that wraps all of the line's elements, including gutter elements). + class should be the name of the class to apply. */ + addLineClass(line: any, where: string, _class_: string): CodeMirror.LineHandle; + + /** Remove a CSS class from a line.line can be a line handle or number. + where should be one of "text", "background", or "wrap"(see addLineClass). + class can be left off to remove all classes for the specified node, or be a string to remove only a specific class. */ + removeLineClass(line: any, where: string, class_?: string): CodeMirror.LineHandle; + + /** Compute the line at the given pixel height. mode is the relative element + to use to compute this line, it may be "window", "page" (the default), or "local" */ + lineAtHeight(height: number, mode?: CoordsMode): number; + + /** Computes the height of the top of a line, in the coordinate system specified by mode, it may be "window", + "page" (the default), or "local". When a line below the bottom of the document is specified, the returned value + is the bottom of the last line in the document. By default, the position of the actual text is returned. + If includeWidgets is true and the line has line widgets, the position above the first line widget is returned. */ + heightAtLine(line: any, mode?: CoordsMode, includeWidgets?: boolean): number; + + /** Returns the line number, text content, and marker status of the given line, which can be either a number or a line handle. */ + lineInfo( + line: any, + ): { + line: any; + handle: any; + text: string; + /** Object mapping gutter IDs to marker elements. */ + gutterMarkers: any; + textClass: string; + bgClass: string; + wrapClass: string; + /** Array of line widgets attached to this line. */ + widgets: any; + }; + + /** Puts node, which should be an absolutely positioned DOM node, into the editor, positioned right below the given { line , ch } position. + When scrollIntoView is true, the editor will ensure that the entire node is visible (if possible). + To remove the widget again, simply use DOM methods (move it somewhere else, or call removeChild on its parent). */ + addWidget(pos: CodeMirror.Position, node: HTMLElement, scrollIntoView: boolean): void; + + /** Adds a line widget, an element shown below a line, spanning the whole of the editor's width, and moving the lines below it downwards. + line should be either an integer or a line handle, and node should be a DOM node, which will be displayed below the given line. + options, when given, should be an object that configures the behavior of the widget. + Note that the widget node will become a descendant of nodes with CodeMirror-specific CSS classes, and those classes might in some cases affect it. */ + addLineWidget(line: any, node: HTMLElement, options?: CodeMirror.LineWidgetOptions): CodeMirror.LineWidget; + + /** Programatically set the size of the editor (overriding the applicable CSS rules). + width and height height can be either numbers(interpreted as pixels) or CSS units ("100%", for example). + You can pass null for either of them to indicate that that dimension should not be changed. */ + setSize(width: any, height: any): void; + + /** Scroll the editor to a given(pixel) position.Both arguments may be left as null or undefined to have no effect. */ + scrollTo(x?: number | null, y?: number | null): void; + + /** Get an { left , top , width , height , clientWidth , clientHeight } object that represents the current scroll position, the size of the scrollable area, + and the size of the visible area(minus scrollbars). */ + getScrollInfo(): CodeMirror.ScrollInfo; + + /** Scrolls the given element into view. pos is a { line , ch } position, referring to a given character, null, to refer to the cursor. + The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */ + scrollIntoView(pos: CodeMirror.Position | null, margin?: number): void; + + /** Scrolls the given element into view. pos is a { left , top , right , bottom } object, in editor-local coordinates. + The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */ + scrollIntoView(pos: { left: number; top: number; right: number; bottom: number }, margin?: number): void; + + /** Scrolls the given element into view. pos is a { line, ch } object, in editor-local coordinates. + The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */ + scrollIntoView(pos: { line: number; ch: number }, margin?: number): void; + + /** Scrolls the given element into view. pos is a { from, to } object, in editor-local coordinates. + The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */ + scrollIntoView(pos: { from: CodeMirror.Position; to: CodeMirror.Position }, margin?: number): void; + + /** Returns an { left , top , bottom } object containing the coordinates of the cursor position. + If mode is "local", they will be relative to the top-left corner of the editable document. + If it is "page" or not given, they are relative to the top-left corner of the page. + where is a boolean indicating whether you want the start(true) or the end(false) of the selection. */ + cursorCoords(where?: boolean, mode?: CoordsMode): { left: number; top: number; bottom: number }; + + /** Returns an { left , top , bottom } object containing the coordinates of the cursor position. + If mode is "local", they will be relative to the top-left corner of the editable document. + If it is "page" or not given, they are relative to the top-left corner of the page. + where specifies the precise position at which you want to measure. */ + cursorCoords( + where?: CodeMirror.Position | null, + mode?: CoordsMode, + ): { left: number; top: number; bottom: number }; + + /** Returns the position and dimensions of an arbitrary character. pos should be a { line , ch } object. + If mode is "local", they will be relative to the top-left corner of the editable document. + If it is "page" or not given, they are relative to the top-left corner of the page. + This differs from cursorCoords in that it'll give the size of the whole character, + rather than just the position that the cursor would have when it would sit at that position. */ + charCoords( + pos: CodeMirror.Position, + mode?: CoordsMode, + ): { left: number; right: number; top: number; bottom: number }; + + /** Given an { left , top } object , returns the { line , ch } position that corresponds to it. + The optional mode parameter determines relative to what the coordinates are interpreted. + It may be "window", "page" (the default), or "local". */ + coordsChar(object: { left: number; top: number }, mode?: CoordsMode): CodeMirror.Position; + + /** Returns the line height of the default font for the editor. */ + defaultTextHeight(): number; + + /** Returns the pixel width of an 'x' in the default font for the editor. + (Note that for non - monospace fonts , this is mostly useless, and even for monospace fonts, non - ascii characters might have a different width). */ + defaultCharWidth(): number; + + /** Returns a { from , to } object indicating the start (inclusive) and end (exclusive) of the currently rendered part of the document. + In big documents, when most content is scrolled out of view, CodeMirror will only render the visible part, and a margin around it. + See also the viewportChange event. */ + getViewport(): { from: number; to: number }; + + /** If your code does something to change the size of the editor element (window resizes are already listened for), or unhides it, + you should probably follow up by calling this method to ensure CodeMirror is still looking as intended. */ + refresh(): void; + + /** Gets the inner mode at a given position. This will return the same as getMode for simple modes, but will return an inner mode for nesting modes (such as htmlmixed). */ + getModeAt(pos: Position): any; + + /** Retrieves information about the token the current mode found before the given position (a {line, ch} object). */ + getTokenAt(pos: CodeMirror.Position, precise?: boolean): Token; + + /** This is a (much) cheaper version of getTokenAt useful for when you just need the type of the token at a given position, + and no other information. Will return null for unstyled tokens, and a string, potentially containing multiple + space-separated style names, otherwise. */ + getTokenTypeAt(pos: CodeMirror.Position): string; + + /** This is similar to getTokenAt, but collects all tokens for a given line into an array. */ + getLineTokens(line: number, precise?: boolean): Token[]; + + /** Returns the mode's parser state, if any, at the end of the given line number. + If no line number is given, the state at the end of the document is returned. + This can be useful for storing parsing errors in the state, or getting other kinds of contextual information for a line. */ + getStateAfter(line?: number): any; + + /** CodeMirror internally buffers changes and only updates its DOM structure after it has finished performing some operation. + If you need to perform a lot of operations on a CodeMirror instance, you can call this method with a function argument. + It will call the function, buffering up all changes, and only doing the expensive update after the function returns. + This can be a lot faster. The return value from this method will be the return value of your function. */ + operation(fn: () => T): T; + + /** In normal circumstances, use the above operation method. But if you want to buffer operations happening asynchronously, or that can't all be wrapped in a callback + function, you can call startOperation to tell CodeMirror to start buffering changes, and endOperation to actually render all the updates. Be careful: if you use this + API and forget to call endOperation, the editor will just never update. */ + startOperation(): void; + endOperation(): void; + + /** Adjust the indentation of the given line. + The second argument (which defaults to "smart") may be one of: + "prev" Base indentation on the indentation of the previous line. + "smart" Use the mode's smart indentation if available, behave like "prev" otherwise. + "add" Increase the indentation of the line by one indent unit. + "subtract" Reduce the indentation of the line. */ + indentLine(line: number, dir?: string): void; + + /** Indent a selection */ + indentSelection(how: string): void; + + /** Tells you whether the editor's content can be edited by the user. */ + isReadOnly(): boolean; + + /** Switches between overwrite and normal insert mode (when not given an argument), + or sets the overwrite mode to a specific state (when given an argument). */ + toggleOverwrite(value?: boolean): void; + + /** Runs the command with the given name on the editor. */ + execCommand(name: string): void; + + /** Give the editor focus. */ + focus(): void; + + /** Returns the hidden textarea used to read input. */ + getInputField(): HTMLTextAreaElement; + + /** Returns the DOM node that represents the editor, and controls its size. Remove this from your tree to delete an editor instance. */ + getWrapperElement(): HTMLElement; + + /** Returns the DOM node that is responsible for the scrolling of the editor. */ + getScrollerElement(): HTMLElement; + + /** Fetches the DOM node that contains the editor gutters. */ + getGutterElement(): HTMLElement; + + /** Fires every time the content of the editor is changed. */ + on( + eventName: 'change', + handler: (instance: CodeMirror.Editor, changeObj: CodeMirror.EditorChangeLinkedList) => void, + ): void; + off( + eventName: 'change', + handler: (instance: CodeMirror.Editor, changeObj: CodeMirror.EditorChangeLinkedList) => void, + ): void; + + /** Like the "change" event, but batched per operation, passing an + * array containing all the changes that happened in the operation. + * This event is fired after the operation finished, and display + * changes it makes will trigger a new operation. */ + on( + eventName: 'changes', + handler: (instance: CodeMirror.Editor, changes: CodeMirror.EditorChangeLinkedList[]) => void, + ): void; + off( + eventName: 'changes', + handler: (instance: CodeMirror.Editor, changes: CodeMirror.EditorChangeLinkedList[]) => void, + ): void; + + /** This event is fired before a change is applied, and its handler may choose to modify or cancel the change. + The changeObj never has a next property, since this is fired for each individual change, and not batched per operation. + Note: you may not do anything from a "beforeChange" handler that would cause changes to the document or its visualization. + Doing so will, since this handler is called directly from the bowels of the CodeMirror implementation, + probably cause the editor to become corrupted. */ + on( + eventName: 'beforeChange', + handler: (instance: CodeMirror.Editor, changeObj: CodeMirror.EditorChangeCancellable) => void, + ): void; + off( + eventName: 'beforeChange', + handler: (instance: CodeMirror.Editor, changeObj: CodeMirror.EditorChangeCancellable) => void, + ): void; + + /** Will be fired when the cursor or selection moves, or any change is made to the editor content. */ + on(eventName: 'cursorActivity', handler: (instance: CodeMirror.Editor) => void): void; + off(eventName: 'cursorActivity', handler: (instance: CodeMirror.Editor) => void): void; + + /** Fired after a key is handled through a key map. name is the name of the handled key (for example "Ctrl-X" or "'q'"), and event is the DOM keydown or keypress event. */ + on( + eventName: 'keyHandled', + handler: (instance: CodeMirror.Editor, name: string, event: KeyboardEvent) => void, + ): void; + off( + eventName: 'keyHandled', + handler: (instance: CodeMirror.Editor, name: string, event: KeyboardEvent) => void, + ): void; + + /** Fired whenever new input is read from the hidden textarea (typed or pasted by the user). */ + on(eventName: 'inputRead', handler: (instance: CodeMirror.Editor, changeObj: EditorChange) => void): void; + off(eventName: 'inputRead', handler: (instance: CodeMirror.Editor, changeObj: EditorChange) => void): void; + + /** Fired if text input matched the mode's electric patterns, and this caused the line's indentation to change. */ + on(eventName: 'electricInput', handler: (instance: CodeMirror.Editor, line: number) => void): void; + off(eventName: 'electricInput', handler: (instance: CodeMirror.Editor, line: number) => void): void; + + /** This event is fired before the selection is moved. Its handler may modify the resulting selection head and anchor. + Handlers for this event have the same restriction as "beforeChange" handlers they should not do anything to directly update the state of the editor. */ + on(eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, obj: EditorSelectionChange) => void ): void; + off(eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, obj: EditorSelectionChange) => void ): void; + + /** Fires whenever the view port of the editor changes (due to scrolling, editing, or any other factor). + The from and to arguments give the new start and end of the viewport. */ + on(eventName: 'viewportChange', handler: (instance: CodeMirror.Editor, from: number, to: number) => void): void; + off( + eventName: 'viewportChange', + handler: (instance: CodeMirror.Editor, from: number, to: number) => void, + ): void; + + /** This is signalled when the editor's document is replaced using the swapDoc method. */ + on(eventName: 'swapDoc', handler: (instance: CodeMirror.Editor, oldDoc: CodeMirror.Doc) => void): void; + off(eventName: 'swapDoc', handler: (instance: CodeMirror.Editor, oldDoc: CodeMirror.Doc) => void): void; + + /** Fires when the editor gutter (the line-number area) is clicked. Will pass the editor instance as first argument, + the (zero-based) number of the line that was clicked as second argument, the CSS class of the gutter that was clicked as third argument, + and the raw mousedown event object as fourth argument. */ + on( + eventName: 'gutterClick', + handler: (instance: CodeMirror.Editor, line: number, gutter: string, clickEvent: MouseEvent) => void, + ): void; + off( + eventName: 'gutterClick', + handler: (instance: CodeMirror.Editor, line: number, gutter: string, clickEvent: MouseEvent) => void, + ): void; + + /** Fires when the editor gutter (the line-number area) receives a contextmenu event. Will pass the editor instance as first argument, + the (zero-based) number of the line that was clicked as second argument, the CSS class of the gutter that was clicked as third argument, + and the raw contextmenu mouse event object as fourth argument. You can preventDefault the event, to signal that CodeMirror should do no + further handling. */ + on( + eventName: 'gutterContextMenu', + handler: (instance: CodeMirror.Editor, line: number, gutter: string, contextMenu: MouseEvent) => void, + ): void; + off( + eventName: 'gutterContextMenu', + handler: (instance: CodeMirror.Editor, line: number, gutter: string, contextMenu: MouseEvent) => void, + ): void; + + /** Fires whenever the editor is focused. */ + on(eventName: 'focus', handler: (instance: CodeMirror.Editor, event: FocusEvent) => void): void; + off(eventName: 'focus', handler: (instance: CodeMirror.Editor, event: FocusEvent) => void): void; + + /** Fires whenever the editor is unfocused. */ + on(eventName: 'blur', handler: (instance: CodeMirror.Editor, event: FocusEvent) => void): void; + off(eventName: 'blur', handler: (instance: CodeMirror.Editor, event: FocusEvent) => void): void; + + /** Fires when the editor is scrolled. */ + on(eventName: 'scroll', handler: (instance: CodeMirror.Editor) => void): void; + off(eventName: 'scroll', handler: (instance: CodeMirror.Editor) => void): void; + + /** Fires when the editor is refreshed or resized. Mostly useful to invalidate cached values that depend on the editor or character size. */ + on(eventName: 'refresh', handler: (instance: CodeMirror.Editor) => void): void; + off(eventName: 'refresh', handler: (instance: CodeMirror.Editor) => void): void; + + /** Dispatched every time an option is changed with setOption. */ + on(eventName: 'optionChange', handler: (instance: CodeMirror.Editor, option: string) => void): void; + off(eventName: 'optionChange', handler: (instance: CodeMirror.Editor, option: string) => void): void; + + /** Fires when the editor tries to scroll its cursor into view. Can be hooked into to take care of additional scrollable containers around the editor. When the event object has its preventDefault method called, CodeMirror will not itself try to scroll the window. */ + on(eventName: 'scrollCursorIntoView', handler: (instance: CodeMirror.Editor, event: Event) => void): void; + off(eventName: 'scrollCursorIntoView', handler: (instance: CodeMirror.Editor, event: Event) => void): void; + + /** Will be fired whenever CodeMirror updates its DOM display. */ + on(eventName: 'update', handler: (instance: CodeMirror.Editor) => void): void; + off(eventName: 'update', handler: (instance: CodeMirror.Editor) => void): void; + + /** Fired whenever a line is (re-)rendered to the DOM. Fired right after the DOM element is built, before it is added to the document. + The handler may mess with the style of the resulting element, or add event handlers, but should not try to change the state of the editor. */ + on( + eventName: 'renderLine', + handler: (instance: CodeMirror.Editor, line: CodeMirror.LineHandle, element: HTMLElement) => void, + ): void; + off( + eventName: 'renderLine', + handler: (instance: CodeMirror.Editor, line: CodeMirror.LineHandle, element: HTMLElement) => void, + ): void; + + /** Fires when one of the global DOM events fires. */ + on( + eventName: K, + handler: (instance: CodeMirror.Editor, event: GlobalEventHandlersEventMap[K]) => void, + ): void; + off( + eventName: K, + handler: (instance: CodeMirror.Editor, event: GlobalEventHandlersEventMap[K]) => void, + ): void; + + /** Fires when one of the clipboard DOM events fires. */ + on( + eventName: K, + handler: (instance: CodeMirror.Editor, event: DocumentAndElementEventHandlersEventMap[K]) => void, + ): void; + off( + eventName: K, + handler: (instance: CodeMirror.Editor, event: DocumentAndElementEventHandlersEventMap[K]) => void, + ): void; + + /** Fires when the overwrite flag is flipped. */ + on(eventName: 'overwriteToggle', handler: (instance: CodeMirror.Editor, overwrite: boolean) => void): void; + + /** Events are registered with the on method (and removed with the off method). + These are the events that fire on the instance object. The name of the event is followed by the arguments that will be passed to the handler. + The instance argument always refers to the editor instance. */ + on(eventName: string, handler: (instance: CodeMirror.Editor) => void): void; + off(eventName: string, handler: (instance: CodeMirror.Editor) => void): void; + + /** Expose the state object, so that the Editor.state.completionActive property is reachable*/ + state: any; + } + + interface EditorFromTextArea extends Editor { + /** Copy the content of the editor into the textarea. */ + save(): void; + + /** Remove the editor, and restore the original textarea (with the editor's current content). */ + toTextArea(): void; + + /** Returns the textarea that the instance was based on. */ + getTextArea(): HTMLTextAreaElement; + } + + interface DocConstructor { + new (text: string, mode?: any, firstLineNumber?: number, lineSep?: string): Doc; + (text: string, mode?: any, firstLineNumber?: number, lineSep?: string): Doc; + } + + interface Doc { + /** Get the mode option **/ + modeOption: any; + + /** Get the current editor content. You can pass it an optional argument to specify the string to be used to separate lines (defaults to "\n"). */ + getValue(seperator?: string): string; + + /** Set the editor content. */ + setValue(content: string): void; + + /** Get the text between the given points in the editor, which should be {line, ch} objects. + An optional third argument can be given to indicate the line separator string to use (defaults to "\n"). */ + getRange(from: Position, to: CodeMirror.Position, seperator?: string): string; + + /** Replace the part of the document between from and to with the given string. + from and to must be {line, ch} objects. to can be left off to simply insert the string at position from. */ + replaceRange(replacement: string | string[], from: CodeMirror.Position, to?: CodeMirror.Position, origin?: string): void; + + /** Get the content of line n. */ + getLine(n: number): string; + + /** Set the content of line n. */ + setLine(n: number, text: string): void; + + /** Remove the given line from the document. */ + removeLine(n: number): void; + + /** Get the number of lines in the editor. */ + lineCount(): number; + + /** Get the first line of the editor. This will usually be zero but for linked sub-views, + or documents instantiated with a non-zero first line, it might return other values. */ + firstLine(): number; + + /** Get the last line of the editor. This will usually be lineCount() - 1, but for linked sub-views, it might return other values. */ + lastLine(): number; + + /** Fetches the line handle for the given line number. */ + getLineHandle(num: number): CodeMirror.LineHandle; + + /** Given a line handle, returns the current position of that line (or null when it is no longer in the document). */ + getLineNumber(handle: CodeMirror.LineHandle): number | null; + + /** Iterate over the whole document, and call f for each line, passing the line handle. + This is a faster way to visit a range of line handlers than calling getLineHandle for each of them. + Note that line handles have a text property containing the line's content (as a string). */ + eachLine(f: (line: CodeMirror.LineHandle) => void): void; + + /** Iterate over the range from start up to (not including) end, and call f for each line, passing the line handle. + This is a faster way to visit a range of line handlers than calling getLineHandle for each of them. + Note that line handles have a text property containing the line's content (as a string). */ + eachLine(start: number, end: number, f: (line: CodeMirror.LineHandle) => void): void; + + /** Set the editor content as 'clean', a flag that it will retain until it is edited, and which will be set again + when such an edit is undone again. Useful to track whether the content needs to be saved. This function is deprecated + in favor of changeGeneration, which allows multiple subsystems to track different notions of cleanness without interfering.*/ + markClean(): void; + + /** Returns a number that can later be passed to isClean to test whether any edits were made (and not undone) in the + meantime. If closeEvent is true, the current history event will be ‘closed’, meaning it can't be combined with further + changes (rapid typing or deleting events are typically combined).*/ + changeGeneration(closeEvent?: boolean): number; + + /** Returns whether the document is currently clean — not modified since initialization or the last call to markClean if + no argument is passed, or since the matching call to changeGeneration if a generation value is given. */ + isClean(generation?: number): boolean; + + /** Get the currently selected code. */ + getSelection(): string; + + /** Returns an array containing a string for each selection, representing the content of the selections. */ + getSelections(lineSep?: string): Array; + + /** Replace the selection with the given string. By default, the new selection will span the inserted text. + The optional collapse argument can be used to change this -- passing "start" or "end" will collapse the selection to the start or end of the inserted text. */ + replaceSelection(replacement: string, collapse?: string): void; + + /** start is a an optional string indicating which end of the selection to return. + It may be "from", "to", "head" (the side of the selection that moves when you press shift+arrow), + or "anchor" (the fixed side of the selection).Omitting the argument is the same as passing "head". A {line, ch} object will be returned. **/ + getCursor(start?: string): CodeMirror.Position; + + /** Retrieves a list of all current selections. These will always be sorted, and never overlap (overlapping selections are merged). + Each object in the array contains anchor and head properties referring to {line, ch} objects. */ + listSelections(): Range[]; + + /** Return true if any text is selected. */ + somethingSelected(): boolean; + + /** Set the cursor position. You can either pass a single {line, ch} object, or the line and the character as two separate parameters. + Will replace all selections with a single, empty selection at the given position. + The supported options are the same as for setSelection */ + setCursor( + pos: CodeMirror.Position | number, + ch?: number, + options?: { bias?: number; origin?: string; scroll?: boolean }, + ): void; + + /** Set a single selection range. anchor and head should be {line, ch} objects. head defaults to anchor when not given. */ + setSelection( + anchor: CodeMirror.Position, + head?: CodeMirror.Position, + options?: { bias?: number; origin?: string; scroll?: boolean }, + ): void; + + /** Sets a new set of selections. There must be at least one selection in the given array. When primary is a + number, it determines which selection is the primary one. When it is not given, the primary index is taken from + the previous selection, or set to the last range if the previous selection had less ranges than the new one. + Supports the same options as setSelection. */ + setSelections( + ranges: Array<{ anchor: CodeMirror.Position; head: CodeMirror.Position }>, + primary?: number, + options?: { bias?: number; origin?: string; scroll?: boolean }, + ): void; + + /** Similar to setSelection , but will, if shift is held or the extending flag is set, + move the head of the selection while leaving the anchor at its current place. + pos2 is optional , and can be passed to ensure a region (for example a word or paragraph) will end up selected + (in addition to whatever lies between that region and the current anchor). */ + extendSelection(from: CodeMirror.Position, to?: CodeMirror.Position): void; + + /** Sets or clears the 'extending' flag , which acts similar to the shift key, + in that it will cause cursor movement and calls to extendSelection to leave the selection anchor in place. */ + setExtending(value: boolean): void; + + /** Retrieve the editor associated with a document. May return null. */ + getEditor(): CodeMirror.Editor | null; + + /** Create an identical copy of the given doc. When copyHistory is true , the history will also be copied.Can not be called directly on an editor. */ + copy(copyHistory: boolean): CodeMirror.Doc; + + /** Create a new document that's linked to the target document. Linked documents will stay in sync (changes to one are also applied to the other) until unlinked. */ + linkedDoc(options: { + /** When turned on, the linked copy will share an undo history with the original. + Thus, something done in one of the two can be undone in the other, and vice versa. */ + sharedHist?: boolean; + from?: number; + /** Can be given to make the new document a subview of the original. Subviews only show a given range of lines. + Note that line coordinates inside the subview will be consistent with those of the parent, + so that for example a subview starting at line 10 will refer to its first line as line 10, not 0. */ + to?: number; + /** By default, the new document inherits the mode of the parent. This option can be set to a mode spec to give it a different mode. */ + mode: any; + }): CodeMirror.Doc; + + /** Break the link between two documents. After calling this , changes will no longer propagate between the documents, + and, if they had a shared history, the history will become separate. */ + unlinkDoc(doc: CodeMirror.Doc): void; + + /** Will call the given function for all documents linked to the target document. It will be passed two arguments, + the linked document and a boolean indicating whether that document shares history with the target. */ + iterLinkedDocs(fn: (doc: CodeMirror.Doc, sharedHist: boolean) => void): void; + + /** Undo one edit (if any undo events are stored). */ + undo(): void; + + /** Redo one undone edit. */ + redo(): void; + + /** Returns an object with {undo, redo } properties , both of which hold integers , indicating the amount of stored undo and redo operations. */ + historySize(): { undo: number; redo: number }; + + /** Clears the editor's undo history. */ + clearHistory(): void; + + /** Get a(JSON - serializeable) representation of the undo history. */ + getHistory(): any; + + /** Replace the editor's undo history with the one provided, which must be a value as returned by getHistory. + Note that this will have entirely undefined results if the editor content isn't also the same as it was when getHistory was called. */ + setHistory(history: any): void; + + /** Can be used to mark a range of text with a specific CSS class name. from and to should be { line , ch } objects. */ + markText( + from: CodeMirror.Position, + to: CodeMirror.Position, + options?: CodeMirror.TextMarkerOptions, + ): TextMarker; + + /** Inserts a bookmark, a handle that follows the text around it as it is being edited, at the given position. + A bookmark has two methods find() and clear(). The first returns the current position of the bookmark, if it is still in the document, + and the second explicitly removes the bookmark. */ + setBookmark( + pos: CodeMirror.Position, + options?: { + /** Can be used to display a DOM node at the current location of the bookmark (analogous to the replacedWith option to markText). */ + widget?: HTMLElement; + + /** By default, text typed when the cursor is on top of the bookmark will end up to the right of the bookmark. + Set this option to true to make it go to the left instead. */ + insertLeft?: boolean; + }, + ): CodeMirror.TextMarker; + + /** Returns an array of all the bookmarks and marked ranges found between the given positions. */ + findMarks(from: CodeMirror.Position, to: CodeMirror.Position): TextMarker[]; + + /** Returns an array of all the bookmarks and marked ranges present at the given position. */ + findMarksAt(pos: CodeMirror.Position): TextMarker[]; + + /** Returns an array containing all marked ranges in the document. */ + getAllMarks(): CodeMirror.TextMarker[]; + + /** Adds a line widget, an element shown below a line, spanning the whole of the editor's width, and moving the lines below it downwards. + line should be either an integer or a line handle, and node should be a DOM node, which will be displayed below the given line. + options, when given, should be an object that configures the behavior of the widget. + Note that the widget node will become a descendant of nodes with CodeMirror-specific CSS classes, and those classes might in some cases affect it. */ + addLineWidget(line: any, node: HTMLElement, options?: CodeMirror.LineWidgetOptions): CodeMirror.LineWidget; + + /** Remove the line widget */ + removeLineWidget(widget: CodeMirror.LineWidget): void; + + /** Gets the mode object for the editor. Note that this is distinct from getOption("mode"), which gives you the mode specification, + rather than the resolved, instantiated mode object. */ + getMode(): any; + + /** Returns the preferred line separator string for this document, as per the option by the same name. When that option is null, the string "\n" is returned. */ + lineSeparator(): string; + + /** Calculates and returns a { line , ch } object for a zero-based index whose value is relative to the start of the editor's text. + If the index is out of range of the text then the returned object is clipped to start or end of the text respectively. */ + posFromIndex(index: number): CodeMirror.Position; + + /** The reverse of posFromIndex. */ + indexFromPos(object: CodeMirror.Position): number; + + /** Expose the state object, so that the Doc.state.completionActive property is reachable*/ + state: any; + } + + interface LineHandle { + text: string; + } + + interface ScrollInfo { + left: any; + top: any; + width: any; + height: any; + clientWidth: any; + clientHeight: any; + } + + interface TextMarker extends Partial { + /** Remove the mark. */ + clear(): void; + + /** Returns a {from, to} object (both holding document positions), indicating the current position of the marked range, + or undefined if the marker is no longer in the document. */ + find(): { from: CodeMirror.Position; to: CodeMirror.Position }; + + /** Called when you've done something that might change the size of the marker and want to cheaply update the display*/ + changed(): void; + + /** Fired when the cursor enters the marked range */ + on(eventName: 'beforeCursorEnter', handler: () => void): void; + off(eventName: 'beforeCursorEnter', handler: () => void): void; + + /** Fired when the range is cleared, either through cursor movement in combination with clearOnEnter or through a call to its clear() method */ + on(eventName: 'clear', handler: (from: Position, to: Position) => void): void; + off(eventName: 'clear', handler: () => void): void; + + /** Fired when the last part of the marker is removed from the document by editing operations */ + on(eventName: 'hide', handler: () => void): void; + off(eventname: 'hide', handler: () => void): void; + + /** Fired when, after the marker was removed by editing, a undo operation brough the marker back */ + on(eventName: 'unhide', handler: () => void): void; + off(eventname: 'unhide', handler: () => void): void; + } + + interface LineWidget { + /** Removes the widget. */ + clear(): void; + + /** Call this if you made some change to the widget's DOM node that might affect its height. + It'll force CodeMirror to update the height of the line that contains the widget. */ + changed(): void; + } + + interface LineWidgetOptions { + /** Whether the widget should cover the gutter. */ + coverGutter?: boolean; + /** Whether the widget should stay fixed in the face of horizontal scrolling. */ + noHScroll?: boolean; + /** Causes the widget to be placed above instead of below the text of the line. */ + above?: boolean; + /** When true, will cause the widget to be rendered even if the line it is associated with is hidden. */ + showIfHidden?: boolean; + /** Determines whether the editor will capture mouse and drag events occurring in this widget. + Default is false—the events will be left alone for the default browser handler, or specific handlers on the widget, to capture. */ + handleMouseEvents?: boolean; + /** By default, the widget is added below other widgets for the line. + This option can be used to place it at a different position (zero for the top, N to put it after the Nth other widget). + Note that this only has effect once, when the widget is created. */ + insertAt?: number; + /** Add an extra CSS class name to the wrapper element created for the widget. */ + className?: string; + } + + interface EditorChange { + /** Position (in the pre-change coordinate system) where the change started. */ + from: CodeMirror.Position; + /** Position (in the pre-change coordinate system) where the change ended. */ + to: CodeMirror.Position; + /** Array of strings representing the text that replaced the changed range (split by line). */ + text: string[]; + /** Text that used to be between from and to, which is overwritten by this change. */ + removed?: string[]; + /** String representing the origin of the change event and wether it can be merged with history */ + origin?: string; + } + + interface EditorChangeLinkedList extends CodeMirror.EditorChange { + /** Points to another change object (which may point to another, etc). */ + next?: CodeMirror.EditorChangeLinkedList; + } + + interface EditorChangeCancellable extends CodeMirror.EditorChange { + /** may be used to modify the change. All three arguments to update are optional, and can be left off to leave the existing value for that field intact. + If the change came from undo/redo, `update` is undefined and the change cannot be modified. */ + update?(from?: CodeMirror.Position, to?: CodeMirror.Position, text?: string[]): void; + + cancel(): void; + } + + interface PositionConstructor { + new (line: number, ch?: number, sticky?: string): Position; + (line: number, ch?: number, sticky?: string): Position; + } + + interface EditorSelectionChange { + ranges: Range[]; + update(ranges: Range[]): void; + origin?: string; + } + + interface Range { + anchor: CodeMirror.Position; + head: CodeMirror.Position; + from(): CodeMirror.Position; + to(): CodeMirror.Position; + empty(): boolean; + } + + interface Position { + ch: number; + line: number; + sticky?: string; + } + + type InputStyle = 'textarea' | 'contenteditable'; + + interface EditorConfiguration { + /** string| The starting value of the editor. Can be a string, or a document object. */ + value?: any; + + /** string|object. The mode to use. When not given, this will default to the first mode that was loaded. + It may be a string, which either simply names the mode or is a MIME type associated with the mode. + Alternatively, it may be an object containing configuration options for the mode, + with a name property that names the mode (for example {name: "javascript", json: true}). */ + mode?: any; + + /** The theme to style the editor with. You must make sure the CSS file defining the corresponding .cm-s-[name] styles is loaded. + The default is "default". */ + theme?: string; + + /** How many spaces a block (whatever that means in the edited language) should be indented. The default is 2. */ + indentUnit?: number; + + /** Whether to use the context-sensitive indentation that the mode provides (or just indent the same as the line before). Defaults to true. */ + smartIndent?: boolean; + + /** The width of a tab character. Defaults to 4. */ + tabSize?: number; + + /** Whether, when indenting, the first N*tabSize spaces should be replaced by N tabs. Default is false. */ + indentWithTabs?: boolean; + + /** Configures whether the editor should re-indent the current line when a character is typed + that might change its proper indentation (only works if the mode supports indentation). Default is true. */ + electricChars?: boolean; + + /** Determines whether horizontal cursor movement through right-to-left (Arabic, Hebrew) text + is visual (pressing the left arrow moves the cursor left) + or logical (pressing the left arrow moves to the next lower index in the string, which is visually right in right-to-left text). + The default is false on Windows, and true on other platforms. */ + rtlMoveVisually?: boolean; + + /** Configures the keymap to use. The default is "default", which is the only keymap defined in codemirror.js itself. + Extra keymaps are found in the keymap directory. See the section on keymaps for more information. */ + keyMap?: string; + + /** Can be used to specify extra keybindings for the editor, alongside the ones defined by keyMap. Should be either null, or a valid keymap value. */ + extraKeys?: string | KeyMap; + + /** Whether CodeMirror should scroll or wrap for long lines. Defaults to false (scroll). */ + lineWrapping?: boolean; + + /** Whether to show line numbers to the left of the editor. */ + lineNumbers?: boolean; + + /** At which number to start counting lines. Default is 1. */ + firstLineNumber?: number; + + /** A function used to format line numbers. The function is passed the line number, and should return a string that will be shown in the gutter. */ + lineNumberFormatter?: (line: number) => string; + + /** Can be used to add extra gutters (beyond or instead of the line number gutter). + Should be an array of CSS class names, each of which defines a width (and optionally a background), + and which will be used to draw the background of the gutters. + May include the CodeMirror-linenumbers class, in order to explicitly set the position of the line number gutter + (it will default to be to the right of all other gutters). These class names are the keys passed to setGutterMarker. */ + gutters?: string[]; + + /** Provides an option foldGutter, which can be used to create a gutter with markers indicating the blocks that can be folded. */ + foldGutter?: boolean; + + /** Determines whether the gutter scrolls along with the content horizontally (false) + or whether it stays fixed during horizontal scrolling (true, the default). */ + fixedGutter?: boolean; + + /** + * Chooses a scrollbar implementation. The default is "native", showing native scrollbars. The core library also + * provides the "null" style, which completely hides the scrollbars. Addons can implement additional scrollbar models. + */ + scrollbarStyle?: string; + + /** + * When fixedGutter is on, and there is a horizontal scrollbar, by default the gutter will be visible to the left of this scrollbar. + * If this option is set to true, it will be covered by an element with class CodeMirror-gutter-filler. + */ + coverGutterNextToScrollbar?: boolean; + + /** + * Selects the way CodeMirror handles input and focus. + * The core library defines the "textarea" and "contenteditable" input models. + * On mobile browsers, the default is "contenteditable". On desktop browsers, the default is "textarea". + * Support for IME and screen readers is better in the "contenteditable" model. + */ + inputStyle?: InputStyle; + + /** boolean|string. This disables editing of the editor content by the user. If the special value "nocursor" is given (instead of simply true), focusing of the editor is also disallowed. */ + readOnly?: any; + + /** This label is read by the screenreaders when CodeMirror text area is focused. This is helpful for accessibility. */ + screenReaderLabel?: string; + + /**Whether the cursor should be drawn when a selection is active. Defaults to false. */ + showCursorWhenSelecting?: boolean; + + /** When enabled, which is the default, doing copy or cut when there is no selection will copy or cut the whole lines that have cursors on them. */ + lineWiseCopyCut?: boolean; + + /** When pasting something from an external source (not from the editor itself), if the number of lines matches the number of selection, CodeMirror will by default insert one line per selection. You can set this to false to disable that behavior. */ + pasteLinesPerSelection?: boolean; + + /** Determines whether multiple selections are joined as soon as they touch (the default) or only when they overlap (true). */ + selectionsMayTouch?: boolean; + + /** The maximum number of undo levels that the editor stores. Defaults to 40. */ + undoDepth?: number; + + /** The period of inactivity (in milliseconds) that will cause a new history event to be started when typing or deleting. Defaults to 500. */ + historyEventDelay?: number; + + /** The tab index to assign to the editor. If not given, no tab index will be assigned. */ + tabindex?: number; + + /** Can be used to make CodeMirror focus itself on initialization. Defaults to off. + When fromTextArea is used, and no explicit value is given for this option, it will be set to true when either the source textarea is focused, + or it has an autofocus attribute and no other element is focused. */ + autofocus?: boolean; + + /** Controls whether drag-and - drop is enabled. On by default. */ + dragDrop?: boolean; + + /** When set (default is null) only files whose type is in the array can be dropped into the editor. + The strings should be MIME types, and will be checked against the type of the File object as reported by the browser. */ + allowDropFileTypes?: Array; + + /** When given , this will be called when the editor is handling a dragenter , dragover , or drop event. + It will be passed the editor instance and the event object as arguments. + The callback can choose to handle the event itself , in which case it should return true to indicate that CodeMirror should not do anything further. */ + onDragEvent?: (instance: CodeMirror.Editor, event: DragEvent) => boolean; + + /** This provides a rather low - level hook into CodeMirror's key handling. + If provided, this function will be called on every keydown, keyup, and keypress event that CodeMirror captures. + It will be passed two arguments, the editor instance and the key event. + This key event is pretty much the raw key event, except that a stop() method is always added to it. + You could feed it to, for example, jQuery.Event to further normalize it. + This function can inspect the key event, and handle it if it wants to. + It may return true to tell CodeMirror to ignore the event. + Be wary that, on some browsers, stopping a keydown does not stop the keypress from firing, whereas on others it does. + If you respond to an event, you should probably inspect its type property and only do something when it is keydown + (or keypress for actions that need character data). */ + onKeyEvent?: (instance: CodeMirror.Editor, event: KeyboardEvent) => boolean; + + /** Half - period in milliseconds used for cursor blinking. The default blink rate is 530ms. */ + cursorBlinkRate?: number; + + /** + * How much extra space to always keep above and below the cursor when + * approaching the top or bottom of the visible view in a scrollable document. Default is 0. + */ + cursorScrollMargin?: number; + + /** Determines the height of the cursor. Default is 1 , meaning it spans the whole height of the line. + For some fonts (and by some tastes) a smaller height (for example 0.85), + which causes the cursor to not reach all the way to the bottom of the line, looks better */ + cursorHeight?: number; + + /** Controls whether, when the context menu is opened with a click outside of the current selection, + the cursor is moved to the point of the click. Defaults to true. */ + resetSelectionOnContextMenu?: boolean; + + /** Highlighting is done by a pseudo background - thread that will work for workTime milliseconds, + and then use timeout to sleep for workDelay milliseconds. + The defaults are 200 and 300, you can change these options to make the highlighting more or less aggressive. */ + workTime?: number; + + /** See workTime. */ + workDelay?: number; + + /** Indicates how quickly CodeMirror should poll its input textarea for changes(when focused). + Most input is captured by events, but some things, like IME input on some browsers, don't generate events that allow CodeMirror to properly detect it. + Thus, it polls. Default is 100 milliseconds. */ + pollInterval?: number; + + /** By default, CodeMirror will combine adjacent tokens into a single span if they have the same class. + This will result in a simpler DOM tree, and thus perform better. With some kinds of styling(such as rounded corners), + this will change the way the document looks. You can set this option to false to disable this behavior. */ + flattenSpans?: boolean; + + /** When enabled (off by default), an extra CSS class will be added to each token, indicating the (inner) mode that produced it, prefixed with "cm-m-". + For example, tokens from the XML mode will get the cm-m-xml class. */ + addModeClass?: boolean; + + /** When highlighting long lines, in order to stay responsive, the editor will give up and simply style + the rest of the line as plain text when it reaches a certain position. The default is 10000. + You can set this to Infinity to turn off this behavior. */ + maxHighlightLength?: number; + + /** Specifies the amount of lines that are rendered above and below the part of the document that's currently scrolled into view. + This affects the amount of updates needed when scrolling, and the amount of work that such an update does. + You should usually leave it at its default, 10. Can be set to Infinity to make sure the whole document is always rendered, + and thus the browser's text search works on it. This will have bad effects on performance of big documents. */ + viewportMargin?: number; + + /** Specifies whether or not spellcheck will be enabled on the input. */ + spellcheck?: boolean; + + /** Specifies whether or not autocorrect will be enabled on the input. */ + autocorrect?: boolean; + + /** Specifies whether or not autocapitalization will be enabled on the input. */ + autocapitalize?: boolean; + + /** Optional lint configuration to be used in conjunction with CodeMirror's linter addon. */ + lint?: boolean | LintStateOptions | Linter | AsyncLinter; + } + + interface TextMarkerOptions { + /** Assigns a CSS class to the marked stretch of text. */ + className?: string; + + /** Determines whether text inserted on the left of the marker will end up inside or outside of it. */ + inclusiveLeft?: boolean; + + /** Like inclusiveLeft , but for the right side. */ + inclusiveRight?: boolean; + + /** Atomic ranges act as a single unit when cursor movement is concerned — i.e. it is impossible to place the cursor inside of them. + In atomic ranges, inclusiveLeft and inclusiveRight have a different meaning — they will prevent the cursor from being placed + respectively directly before and directly after the range. */ + atomic?: boolean; + + /** Collapsed ranges do not show up in the display.Setting a range to be collapsed will automatically make it atomic. */ + collapsed?: boolean; + + /** When enabled, will cause the mark to clear itself whenever the cursor enters its range. + This is mostly useful for text - replacement widgets that need to 'snap open' when the user tries to edit them. + The "clear" event fired on the range handle can be used to be notified when this happens. */ + clearOnEnter?: boolean; + + /** Determines whether the mark is automatically cleared when it becomes empty. Default is true. */ + clearWhenEmpty?: boolean; + + /** Use a given node to display this range.Implies both collapsed and atomic. + The given DOM node must be an inline element(as opposed to a block element). */ + replacedWith?: HTMLElement; + + /** When replacedWith is given, this determines whether the editor will + * capture mouse and drag events occurring in this widget. Default is + * false—the events will be left alone for the default browser handler, + * or specific handlers on the widget, to capture. */ + handleMouseEvents?: boolean; + + /** A read - only span can, as long as it is not cleared, not be modified except by calling setValue to reset the whole document. + Note: adding a read - only span currently clears the undo history of the editor, + because existing undo events being partially nullified by read - only spans would corrupt the history (in the current implementation). */ + readOnly?: boolean; + + /** When set to true (default is false), adding this marker will create an event in the undo history that can be individually undone(clearing the marker). */ + addToHistory?: boolean; + + /** Can be used to specify an extra CSS class to be applied to the leftmost span that is part of the marker. */ + startStyle?: string; + + /** Equivalent to startStyle, but for the rightmost span. */ + endStyle?: string; + + /** A string of CSS to be applied to the covered text. For example "color: #fe3". */ + css?: string; + + /** When given, will give the nodes created for this span a HTML title attribute with the given value. */ + title?: string; + + /** When the target document is linked to other documents, you can set shared to true to make the marker appear in all documents. + By default, a marker appears only in its target document. */ + shared?: boolean; + } + + interface StringStreamConstructor { + new (text: string): StringStream; + } + + interface StringStream { + lastColumnPos: number; + lastColumnValue: number; + lineStart: number; + + /** + * Current position in the string. + */ + pos: number; + + /** + * Where the stream's position was when it was first passed to the token function. + */ + start: number; + + /** + * The current line's content. + */ + string: string; + + /** + * Number of spaces per tab character. + */ + tabSize: number; + + /** + * Returns true only if the stream is at the end of the line. + */ + eol(): boolean; + + /** + * Returns true only if the stream is at the start of the line. + */ + sol(): boolean; + + /** + * Returns the next character in the stream without advancing it. Will return an null at the end of the line. + */ + peek(): string | null; + + /** + * Returns the next character in the stream and advances it. Also returns null when no more characters are available. + */ + next(): string | null; + + /** + * match can be a character, a regular expression, or a function that takes a character and returns a boolean. + * If the next character in the stream 'matches' the given argument, it is consumed and returned. + * Otherwise, undefined is returned. + */ + eat(match: string): string; + eat(match: RegExp): string; + eat(match: (char: string) => boolean): string; + + /** + * Repeatedly calls eat with the given argument, until it fails. Returns true if any characters were eaten. + */ + eatWhile(match: string): boolean; + eatWhile(match: RegExp): boolean; + eatWhile(match: (char: string) => boolean): boolean; + + /** + * Shortcut for eatWhile when matching white-space. + */ + eatSpace(): boolean; + + /** + * Moves the position to the end of the line. + */ + skipToEnd(): void; + + /** + * Skips to the next occurrence of the given character, if found on the current line (doesn't advance the stream if + * the character does not occur on the line). + * + * Returns true if the character was found. + */ + skipTo(ch: string): boolean; + + /** + * Act like a multi-character eat - if consume is true or not given - or a look-ahead that doesn't update the stream + * position - if it is false. pattern can be either a string or a regular expression starting with ^. When it is a + * string, caseFold can be set to true to make the match case-insensitive. When successfully matching a regular + * expression, the returned value will be the array returned by match, in case you need to extract matched groups. + */ + match(pattern: string, consume?: boolean, caseFold?: boolean): boolean; + match(pattern: RegExp, consume?: boolean): string[]; + + /** + * Backs up the stream n characters. Backing it up further than the start of the current token will cause things to + * break, so be careful. + */ + backUp(n: number): void; + + /** + * Returns the column (taking into account tabs) at which the current token starts. + */ + column(): number; + + /** + * Tells you how far the current line has been indented, in spaces. Corrects for tab characters. + */ + indentation(): number; + + /** + * Get the string between the start of the current token and the current stream position. + */ + current(): string; + } + + /** + * A Mode is, in the simplest case, a lexer (tokenizer) for your language — a function that takes a character stream as input, + * advances it past a token, and returns a style for that token. More advanced modes can also handle indentation for the language. + */ + interface Mode { + name?: string; + + /** + * This function should read one token from the stream it is given as an argument, optionally update its state, + * and return a style string, or null for tokens that do not have to be styled. Multiple styles can be returned, separated by spaces. + */ + token?: (stream: StringStream, state: T) => string | null; + + /** + * A function that produces a state object to be used at the start of a document. + */ + startState?: () => T; + /** + * For languages that have significant blank lines, you can define a blankLine(state) method on your mode that will get called + * whenever a blank line is passed over, so that it can update the parser state. + */ + blankLine?: (state: T) => void; + /** + * Given a state returns a safe copy of that state. + */ + copyState?: (state: T) => T; + + /** + * The indentation method should inspect the given state object, and optionally the textAfter string, which contains the text on + * the line that is being indented, and return an integer, the amount of spaces to indent. + */ + indent?: (state: T, textAfter: string) => number; + + /** The four below strings are used for working with the commenting addon. */ + /** + * String that starts a line comment. + */ + lineComment?: string; + /** + * String that starts a block comment. + */ + blockCommentStart?: string; + /** + * String that ends a block comment. + */ + blockCommentEnd?: string; + /** + * String to put at the start of continued lines in a block comment. + */ + blockCommentLead?: string; + + /** + * Trigger a reindent whenever one of the characters in the string is typed. + */ + electricChars?: string; + /** + * Trigger a reindent whenever the regex matches the part of the line before the cursor. + */ + electricinput?: RegExp; + } + + /** + * A function that, given a CodeMirror configuration object and an optional mode configuration object, returns a mode object. + */ + interface ModeFactory { + (config: CodeMirror.EditorConfiguration, modeOptions?: any): Mode; + } + + /** + * id will be the id for the defined mode. Typically, you should use this second argument to defineMode as your module scope function + * (modes should not leak anything into the global scope!), i.e. write your whole mode inside this function. + */ + function defineMode(id: string, modefactory: ModeFactory): void; + + /** + * id will be the id for the defined mode. Typically, you should use this second argument to defineMode as your module scope function + * (modes should not leak anything into the global scope!), i.e. write your whole mode inside this function. + */ + function defineMode(id: string, modefactory: ModeFactory): void; + + /** + * The first argument is a configuration object as passed to the mode constructor function, and the second argument + * is a mode specification as in the EditorConfiguration mode option. + */ + function getMode(config: CodeMirror.EditorConfiguration, mode: any): Mode; + + /** + * Utility function from the overlay.js addon that allows modes to be combined. The mode given as the base argument takes care of + * most of the normal mode functionality, but a second (typically simple) mode is used, which can override the style of text. + * Both modes get to parse all of the text, but when both assign a non-null style to a piece of code, the overlay wins, unless + * the combine argument was true and not overridden, or state.overlay.combineTokens was true, in which case the styles are combined. + */ + function overlayMode(base: Mode, overlay: Mode, combine?: boolean): Mode; + + interface ModeMap { + [modeName: string]: ModeFactory; + } + + /** + * Maps mode names to their constructors + */ + var modes: ModeMap; + + function defineMIME(mime: string, modeSpec: any): void; + + interface MimeModeMap { + [mimeName: string]: any; + } + + /** + * Maps MIME types to mode specs. + */ + var mimeModes: MimeModeMap; + + interface CommandActions { + /** Select the whole content of the editor. */ + selectAll(cm: CodeMirror.Editor): void; + + /** When multiple selections are present, this deselects all but the primary selection. */ + singleSelection(cm: CodeMirror.Editor): void; + + /** Emacs-style line killing. Deletes the part of the line after the cursor. If that consists only of whitespace, the newline at the end of the line is also deleted. */ + killLine(cm: CodeMirror.Editor): void; + + /** Deletes the whole line under the cursor, including newline at the end. */ + deleteLine(cm: CodeMirror.Editor): void; + + /** Delete the part of the line before the cursor. */ + delLineLeft(cm: CodeMirror.Editor): void; + + /** Delete the part of the line from the left side of the visual line the cursor is on to the cursor. */ + delWrappedLineLeft(cm: CodeMirror.Editor): void; + + /** Delete the part of the line from the cursor to the right side of the visual line the cursor is on. */ + delWrappedLineRight(cm: CodeMirror.Editor): void; + + /** Undo the last change. Note that, because browsers still don't make it possible for scripts to react to or customize the context menu, selecting undo (or redo) from the context menu in a CodeMirror instance does not work. */ + undo(cm: CodeMirror.Editor): void; + + /** Redo the last undone change. */ + redo(cm: CodeMirror.Editor): void; + + /** Undo the last change to the selection, or if there are no selection-only changes at the top of the history, undo the last change. */ + undoSelection(cm: CodeMirror.Editor): void; + + /** Redo the last change to the selection, or the last text change if no selection changes remain. */ + redoSelection(cm: CodeMirror.Editor): void; + + /** Move the cursor to the start of the document. */ + goDocStart(cm: CodeMirror.Editor): void; + + /** Move the cursor to the end of the document. */ + goDocEnd(cm: CodeMirror.Editor): void; + + /** Move the cursor to the start of the line. */ + goLineStart(cm: CodeMirror.Editor): void; + + /** Move to the start of the text on the line, or if we are already there, to the actual start of the line (including whitespace). */ + goLineStartSmart(cm: CodeMirror.Editor): void; + + /** Move the cursor to the end of the line. */ + goLineEnd(cm: CodeMirror.Editor): void; + + /** Move the cursor to the right side of the visual line it is on. */ + goLineRight(cm: CodeMirror.Editor): void; + + /** Move the cursor to the left side of the visual line it is on. If this line is wrapped, that may not be the start of the line. */ + goLineLeft(cm: CodeMirror.Editor): void; + + /** Move the cursor to the left side of the visual line it is on. If that takes it to the start of the line, behave like goLineStartSmart. */ + goLineLeftSmart(cm: CodeMirror.Editor): void; + + /** Move the cursor up one line. */ + goLineUp(cm: CodeMirror.Editor): void; + + /** Move down one line. */ + goLineDown(cm: CodeMirror.Editor): void; + + /** Move the cursor up one screen, and scroll up by the same distance. */ + goPageUp(cm: CodeMirror.Editor): void; + + /** Move the cursor down one screen, and scroll down by the same distance. */ + goPageDown(cm: CodeMirror.Editor): void; + + /** Move the cursor one character left, going to the previous line when hitting the start of line. */ + goCharLeft(cm: CodeMirror.Editor): void; + + /** Move the cursor one character right, going to the next line when hitting the end of line. */ + goCharRight(cm: CodeMirror.Editor): void; + + /** Move the cursor one character left, but don't cross line boundaries. */ + goColumnLeft(cm: CodeMirror.Editor): void; + + /** Move the cursor one character right, don't cross line boundaries. */ + goColumnRight(cm: CodeMirror.Editor): void; + + /** Move the cursor to the start of the previous word. */ + goWordLeft(cm: CodeMirror.Editor): void; + + /** Move the cursor to the end of the next word. */ + goWordRight(cm: CodeMirror.Editor): void; + + /** Move to the left of the group before the cursor. A group is a stretch of word characters, a stretch of punctuation characters, a newline, or a stretch of more than one whitespace character. */ + goGroupLeft(cm: CodeMirror.Editor): void; + + /** Move to the right of the group after the cursor (see above). */ + goGroupRight(cm: CodeMirror.Editor): void; + + /** Delete the character before the cursor. */ + delCharBefore(cm: CodeMirror.Editor): void; + + /** Delete the character after the cursor. */ + delCharAfter(cm: CodeMirror.Editor): void; + + /** Delete up to the start of the word before the cursor. */ + delWordBefore(cm: CodeMirror.Editor): void; + + /** Delete up to the end of the word after the cursor. */ + delWordAfter(cm: CodeMirror.Editor): void; + + /** Delete to the left of the group before the cursor. */ + delGroupBefore(cm: CodeMirror.Editor): void; + + /** Delete to the start of the group after the cursor. */ + delGroupAfter(cm: CodeMirror.Editor): void; + + /** Auto-indent the current line or selection. */ + indentAuto(cm: CodeMirror.Editor): void; + + /** Indent the current line or selection by one indent unit. */ + indentMore(cm: CodeMirror.Editor): void; + + /** Dedent the current line or selection by one indent unit. */ + indentLess(cm: CodeMirror.Editor): void; + + /** Insert a tab character at the cursor. */ + insertTab(cm: CodeMirror.Editor): void; + + /** Insert the amount of spaces that match the width a tab at the cursor position would have. */ + insertSoftTab(cm: CodeMirror.Editor): void; + + /** If something is selected, indent it by one indent unit. If nothing is selected, insert a tab character. */ + defaultTabTab(cm: CodeMirror.Editor): void; + + /** Swap the characters before and after the cursor. */ + transposeChars(cm: CodeMirror.Editor): void; + + /** Insert a newline and auto-indent the new line. */ + newlineAndIndent(cm: CodeMirror.Editor): void; + + /** Flip the overwrite flag. */ + toggleOverwrite(cm: CodeMirror.Editor): void; + } + + /** + * Commands are parameter-less actions that can be performed on an editor. + * Their main use is for key bindings. + * Commands are defined by adding properties to the CodeMirror.commands object. + */ + var commands: CommandActions; + + interface LintStateOptions { + /** specifies that the lint process runs asynchronously */ + async?: boolean; + + /** debounce delay before linting onChange */ + delay?: number; + + /** callback to modify an annotation before display */ + formatAnnotation?: (annotation: Annotation) => Annotation + + /** custom linting function provided by the user */ + getAnnotations?: Linter | AsyncLinter; + + /** + * specifies that lint errors should be displayed in the CodeMirror + * gutter, note that you must use this in conjunction with [ "CodeMirror-lint-markers" ] as an element in the gutters argument on + * initialization of the CodeMirror instance. */ + hasGutters?: boolean; + + /** whether to lint onChange event */ + lintOnChange?: boolean; + + /** callback after linter completes */ + onUpdateLinting?: (annotationsNotSorted: Annotation[], annotations: Annotation[], codeMirror: Editor) => void; + + /** + * Passing rules in `options` property prevents JSHint (and other linters) from complaining + * about unrecognized rules like `onUpdateLinting`, `delay`, `lintOnChange`, etc. + */ + options?: any; + + /** controls display of lint tooltips */ + tooltips?: boolean | 'gutter' + } + + /** + * A function that return errors found during the linting process. + */ + interface Linter { + (content: string, options: LintStateOptions | any, codeMirror: Editor): Annotation[] | PromiseLike; + } + + /** + * A function that calls the updateLintingCallback with any errors found during the linting process. + */ + interface AsyncLinter { + ( + content: string, + updateLintingCallback: UpdateLintingCallback, + options: LintStateOptions | any, + codeMirror: Editor, + ): void; + } + + /** + * A function that, given an array of annotations, updates the CodeMirror linting GUI with those annotations + */ + interface UpdateLintingCallback { + (codeMirror: Editor, annotations: Annotation[]): void; + } + + /** + * An annotation contains a description of a lint error, detailing the location of the error within the code, the severity of the error, + * and an explaination as to why the error was thrown. + */ + interface Annotation { + from: Position; + message?: string; + severity?: string; + to?: Position; + } + + /** + * A function that calculates either a two-way or three-way merge between different sets of content. + */ + function MergeView( + element: HTMLElement, + options?: MergeView.MergeViewEditorConfiguration, + ): MergeView.MergeViewEditor; + + namespace MergeView { + /** + * Options available to MergeView. + */ + interface MergeViewEditorConfiguration extends EditorConfiguration { + /** + * Determines whether the original editor allows editing. Defaults to false. + */ + allowEditingOriginals?: boolean; + + /** + * When true stretches of unchanged text will be collapsed. When a number is given, this indicates the amount + * of lines to leave visible around such stretches (which defaults to 2). Defaults to false. + */ + collapseIdentical?: boolean | number; + + /** + * Sets the style used to connect changed chunks of code. By default, connectors are drawn. When this is set to "align", + * the smaller chunk is padded to align with the bigger chunk instead. + */ + connect?: string; + + /** + * Callback for when stretches of unchanged text are collapsed. + */ + onCollapse?(mergeView: MergeViewEditor, line: number, size: number, mark: TextMarker): void; + + /** + * Provides original version of the document to be shown on the right of the editor. + */ + orig: any; + + /** + * Provides original version of the document to be shown on the left of the editor. + * To create a 2-way (as opposed to 3-way) merge view, provide only one of origLeft and origRight. + */ + origLeft?: any; + + /** + * Provides original version of document to be shown on the right of the editor. + * To create a 2-way (as opposed to 3-way) merge view, provide only one of origLeft and origRight. + */ + origRight?: any; + + /** + * Determines whether buttons that allow the user to revert changes are shown. Defaults to true. + */ + revertButtons?: boolean; + + /** + * When true, changed pieces of text are highlighted. Defaults to true. + */ + showDifferences?: boolean; + } + + interface MergeViewEditor extends Editor { + /** + * Returns the editor instance. + */ + editor(): Editor; + + /** + * Left side of the merge view. + */ + left: DiffView; + leftChunks(): MergeViewDiffChunk[]; + leftOriginal(): Editor; + + /** + * Right side of the merge view. + */ + right: DiffView; + rightChunks(): MergeViewDiffChunk[]; + rightOriginal(): Editor; + + /** + * Sets whether or not the merge view should show the differences between the editor views. + */ + setShowDifferences(showDifferences: boolean): void; + } + + /** + * Tracks changes in chunks from oroginal to new. + */ + interface MergeViewDiffChunk { + editFrom: number; + editTo: number; + origFrom: number; + origTo: number; + } + + interface DiffView { + /** + * Forces the view to reload. + */ + forceUpdate(): (mode: string) => void; + + /** + * Sets whether or not the merge view should show the differences between the editor views. + */ + setShowDifferences(showDifferences: boolean): void; + } + } +} diff --git a/node_modules/@types/codemirror/mode/meta.d.ts b/node_modules/@types/codemirror/mode/meta.d.ts new file mode 100644 index 0000000000..e2c90dca3b --- /dev/null +++ b/node_modules/@types/codemirror/mode/meta.d.ts @@ -0,0 +1,25 @@ +// Type definitions for codemirror +// Project: https://github.com/marijnh/CodeMirror +// Definitions by: koddsson +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.2 + +import * as CodeMirror from 'codemirror'; + +interface MimeType { + name: string; + mime?: string; + mimes?: string; + mode: string; + file?: RegExp; + ext?: string[]; + alias?: string[]; +} + +declare module 'codemirror' { + const modeInfo: MimeType[]; + function findModeByMIME(mime: string): MimeType; + function findModeByExtension(ext: string): MimeType; + function findModeByFileName(filename: string): MimeType; + function findModeByName(name: string): MimeType; +} diff --git a/node_modules/@types/codemirror/package.json b/node_modules/@types/codemirror/package.json new file mode 100644 index 0000000000..5182098343 --- /dev/null +++ b/node_modules/@types/codemirror/package.json @@ -0,0 +1,71 @@ +{ + "contributors": [ + { + "githubUsername": "mihailik", + "name": "mihailik", + "url": "https://github.com/mihailik" + }, + { + "githubUsername": "nrbernard", + "name": "nrbernard", + "url": "https://github.com/nrbernard" + }, + { + "githubUsername": "Pr1st0n", + "name": "Pr1st0n", + "url": "https://github.com/Pr1st0n" + }, + { + "githubUsername": "rileymiller", + "name": "rileymiller", + "url": "https://github.com/rileymiller" + }, + { + "githubUsername": "toddself", + "name": "toddself", + "url": "https://github.com/toddself" + }, + { + "githubUsername": "ysulyma", + "name": "ysulyma", + "url": "https://github.com/ysulyma" + }, + { + "githubUsername": "azoson", + "name": "azoson", + "url": "https://github.com/azoson" + }, + { + "githubUsername": "kylesferrazza", + "name": "kylesferrazza", + "url": "https://github.com/kylesferrazza" + }, + { + "githubUsername": "fityocsaba96", + "name": "fityocsaba96", + "url": "https://github.com/fityocsaba96" + }, + { + "githubUsername": "koddsson", + "name": "koddsson", + "url": "https://github.com/koddsson" + } + ], + "dependencies": { + "@types/tern": "*" + }, + "description": "TypeScript definitions for codemirror", + "license": "MIT", + "main": "", + "name": "@types/codemirror", + "repository": { + "directory": "types/codemirror", + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git" + }, + "scripts": {}, + "typeScriptVersion": "3.2", + "types": "index.d.ts", + "typesPublisherContentHash": "f7321e690e67ba8b6ab7fbb28360fb7a5aab6cbb5a6a7e660497baaae3d3794a", + "version": "0.0.97" +} diff --git a/node_modules/@types/tern/LICENSE b/node_modules/@types/tern/LICENSE new file mode 100644 index 0000000000..21071075c2 --- /dev/null +++ b/node_modules/@types/tern/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/tern/README.md b/node_modules/@types/tern/README.md new file mode 100644 index 0000000000..89b48e78ca --- /dev/null +++ b/node_modules/@types/tern/README.md @@ -0,0 +1,16 @@ +# Installation +> `npm install --save @types/tern` + +# Summary +This package contains type definitions for tern ( https://github.com/ternjs/tern ). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/tern + +Additional Details + * Last updated: Thu, 16 May 2019 16:47:42 GMT + * Dependencies: @types/estree + * Global values: none + +# Credits +These definitions were written by Nikolaj Kappler . diff --git a/node_modules/@types/tern/index.d.ts b/node_modules/@types/tern/index.d.ts new file mode 100644 index 0000000000..a5df150ce6 --- /dev/null +++ b/node_modules/@types/tern/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for tern 0.23 +// Project: https://github.com/ternjs/tern +// Definitions by: Nikolaj Kappler +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +export * from "./lib/infer"; +export * from "./lib/tern"; diff --git a/node_modules/@types/tern/lib/infer/index.d.ts b/node_modules/@types/tern/lib/infer/index.d.ts new file mode 100644 index 0000000000..c2d3a717f9 --- /dev/null +++ b/node_modules/@types/tern/lib/infer/index.d.ts @@ -0,0 +1,312 @@ +import * as ESTree from "estree"; +import { Server } from "../tern"; +export { }; + +// #### Context #### +interface ContextConstructor { + new(defs: any[], parent: Server): Context; +} +export const Context: ContextConstructor; +export interface Context { + parent?: Server; + topScope: Scope; + /** The primitive number type. */ + num: Prim & { name: "number" }; + /** The primitive string type. */ + str: Prim & { name: "string" }; + /** The primitive boolean type. */ + bool: Prim & { name: "bool" }; +} +/** Returns the current context object. */ +export function cx(): Context; +/** Calls f with the current context bound to context. Basically, all code that does something with the inference engine should be wrapped in such a call. */ +export function withContext(context: Context, f: () => R): R; + +// #### Analysis #### +/** Parse a piece of code for use by Tern. Will automatically fall back to the error-tolerant parser if the regular parser can’t parse the code. */ +export function parse(text: string, options?: {}): ESTree.Program; +/** + * Analyze a syntax tree. `name` will be used to set the origin of types, properties, and variables produced by this code. + * The optional `scope` argument can be used to specify a scope in which the code should be analyzed. + * It will default to the top-level scope. + */ +export function analyze(ast: ESTree.Program, name: string, scope?: Scope): void; +/** + * Purges the types that have one of the origins given from the context. `start` and `end` can be given to only purge + * types that occurred in the source code between those offsets. This is not entirely precise — the state of the + * context won’t be back where it was before the file was analyzed — but it prevents most of the + * noticeable inaccuracies that re-analysis tends to produce. + */ +export function purgeTypes(origins: string[], start?: number, end?: number): void; +/** + * Cleaning up variables is slightly trickier than cleaning up types. This does a first pass over the given scope, + * and marks variables defined by the given origins. This is indended to be followed by a call to `analyze` and then a call to `purgeMarkedVariables`. + */ +export function markVariablesDefinedBy(scope: Scope, origins: string[], start?: number, end?: number): void; +/** Purges variables that were marked by a call to markVariablesDefinedBy and not re-defined in the meantime. */ +export function purgeMarkedVariables(): void; + +// #### Types #### +interface ObjConstructor { + new(proto: object | true | null, name?: string): Obj; +} +/** Constructor for the type that represents JavaScript objects. `proto` may be another object, or `true` as a short-hand for `Object.prototype`, or `null` for prototype-less objects. */ +export const Obj: ObjConstructor; +export interface Obj extends IType { + /** The name of the type, if any. */ + name: string | undefined; + /** The prototype of the object, or null. */ + proto: (Obj & { name: string }) | null; + /** An object mapping the object’s known properties to AVals. Don’t manipulate this directly (ever), only use it if you have to iterate over the properties. */ + props: Readonly<{ + [key: string]: AVal; + }>; + /** Looks up the AVal associated with the given property, or returns null if it doesn’t exist. */ + hasProp(prop: string): AVal | null; + /** Looks up the given property, or defines it if it did not yet exist (in which case it will be associated with the given AST node). */ + defProp(prop: string, originNode?: ESTree.Node): AVal; + /** + * Asks the AVal if it contains an Object type. Useful when + * you aren’t interested in other kinds of types. + */ + getObjType(): Obj; + getType(): Obj; + /** Get an `AVal` that represents the named property of this type. */ + getProp(prop: string): AVal; + /** Call the given function for all properties of the object, including properties that are added in the future. */ + forAllProps(f: (prop: string, val: AVal, local: boolean) => void): void; + gatherProperties(f: (...args: any[]) => void, depth: number): void; +} + +interface FnConstructor { + new(name: string | undefined, self: AVal, args: AVal[], argNames: string[], retval: AVal): Fn; +} +/** Constructor for the type that implements functions. Inherits from `Obj`. The `AVal` types are used to track the input and output types of the function. */ +export const Fn: FnConstructor; +export interface Fn extends Obj { + readonly args?: AVal[]; + readonly argNames?: string[]; + self?: Type; + readonly retval: AVal; + /** + * Asks the AVal if it contains a function type. Useful when + * you aren’t interested in other kinds of types. + */ + getFunctionType(): Fn; + isArrowFn(): boolean; + getType(): Fn; +} + +interface PrimConstructor { + new(proto: object | null, name?: string): Prim; +} +export const Prim: PrimConstructor; +export interface Prim extends IType { + /** The name of the type, if any. */ + name: "string" | "bool" | "number"; + /** The prototype of the object, or null. */ + proto: Obj & { name: string }; + /** Get an `AVal` that represents the named property of this type. */ + getProp(prop: string): AVal; + getType(): Prim; + gatherProperties(f: (...args: any[]) => void, depth: number): void; +} + +interface ArrConstructor { + /** Constructor that creates an array type with the given content type. */ + new(contentType?: AVal): Arr; +} +export const Arr: ArrConstructor; +export interface Arr extends Obj { + name: "Array"; + getType(): Arr; +} +interface TypeConstructor { + new(): Type; +} +export const Type: TypeConstructor; +export type Type = Obj | Prim; + +// tslint:disable-next-line: interface-name +export interface IType extends ANull { + /** The origin file of the type. */ + origin: string; + /** + * The syntax node that defined the type. Only present for object and function types, + * and even for those it may be missing (if the type was created by a type definition file, + * or synthesized in some other way). + */ + originNode?: ESTree.Node; + /** Return a string that describes the type. maxDepth indicates the depth to which inner types should be shown. */ + toString(maxDepth: number): string; + /** Queries whether the AVal _currently_ holds the given type. */ + hasType(type: Type): boolean; + getType(): Type; +} + +// #### Abstract Values #### + +interface AValConstructor { + new(): AVal; +} +export const AVal: AValConstructor; + +/** + * Abstract values are objects used to represent sets of types. Each variable + * and property has an abstract value associated with it, but they are also + * used for other purposes, such as tracking the return type of a function, + * or building up the type for some kinds of expressions. + * + * In a cleanly typed program where each thing has only a single type, + * abstract values will all have one type associated with them. When, + * for example, a variable can hold two different types of values, + * the associated abstract value will hold both these types. In some cases, + * no type can be assigned to something at all, + * in which case the abstract value remains empty. + */ +export interface AVal extends ANull { + /** + * Add a type to this abstract value. If the type is already in there, + * this is a no-op. weight can be given to give this type a non-default + * weight, which is mostly useful when adding a provisionary type that + * should be overridden later if a real type is found. The default weight + * is 100, and passing a weight lower than that will make the type + * assignment “weak”. + */ + addType(type: Type, weight?: number): void; + /** + * Sets this AVal to propagate all types it receives to the given + * constraint. This is the mechanism by which types are propagated + * through the type graph. + */ + propagate(target: Constraint): void; + /** Queries whether the AVal _currently_ holds the given type. */ + hasType(type: Type): boolean; + /** Queries whether the AVal is empty. */ + isEmpty(): boolean; + /** + * Asks the abstract value for its current type. May return `null` + * when there is no type, or conflicting types are present. When + * `guess` is true or not given, an empty AVal will try to use + * heuristics based on its propagation edges to guess a type. + */ + getType(guess?: boolean): Type | null; + /** + * Asks the AVal if it contains a function type. Useful when + * you aren’t interested in other kinds of types. + */ + getFunctionType(): Fn | undefined; + /** Get an `AVal` that represents the named property of this type. */ + getProp(prop: string): AVal; + /** Call the given function for all properties of the object, including properties that are added in the future. */ + forAllProps(f: (prop: string, val: AVal, local: boolean) => void): void; + /** + * Asks the AVal if it contains an Object type. Useful when + * you aren’t interested in other kinds of types. + */ + getObjType(): Obj | null; + /** + * Abstract values that are used to represent variables + * or properties will have, when possible, an `originNode` + * property pointing to an AST node. + */ + gatherProperties(f: (...args: any[]) => void, depth: number): void; + originNode?: ESTree.Node; + /** An object mapping the object’s known properties to AVals. Don’t manipulate this directly (ever), only use it if you have to iterate over the properties. */ + props: Partial>; + readonly types: Type[]; + readonly propertyOf?: Obj; +} + +/** + * A variant of AVal used for unknown, dead-end values. Also serves + * a prototype for AVals, Types, and Constraints because it + * implements 'empty' versions of all the methods that the code expects. + */ +export const ANull: ANull; +export interface ANull { + addType(...args: any[]): void; + propagate(...args: any[]): void; + getProp(...args: any[]): ANull; + forAllProps(...args: any[]): void; + hasType(...args: any[]): boolean; + isEmpty(...args: any[]): boolean; + getFunctionType(...args: any[]): ANull | undefined; + getObjType(...args: any[]): ANull | undefined | null; + getSymbolType(...args: any[]): ANull | undefined; + getType(...args: any[]): ANull | undefined | null; + gatherProperties(...args: any[]): void; + propagatesTo(): any; + typeHint(...args: any[]): ANull | undefined | null; + propHint(...args: any[]): string | undefined; + toString(...args: any[]): string; +} + +// #### Constraints #### +interface ConstraintConstructor { + new(methods: { [key: string]: any }): { new(): Constraint }; +} +/** + * This is a constructor-constructor for constraints. It’ll create a + * constructor with all the given methods copied into its prototype, + * which will run its construct method on its arguments when instantiated. + */ +export const constraint: ConstraintConstructor; +export interface Constraint extends ANull { + /** May return a type that `getType` can use to “guess” its type based on the fact that it propagates to this constraint. */ + typeHint(): Type | undefined; + /** May return a string when this constraint is indicative of the presence of a specific property in the source AVal. */ + propHint(): string | undefined; +} + +// #### Scopes #### +interface ScopeConstructor { + new(): Scope; + new(parent: Scope, originNode: ESTree.Node): Scope; +} +export const Scope: ScopeConstructor; +export interface Scope extends Obj { + /** + * Ensures that this scope or some scope above it has a property by the given name + * (defining it in the top scope if it is missing), and, if the property doesn’t + * already have an `originNode`, assigns the given node to it. + */ + defVar(name: string, originNode: ESTree.Node): AVal; +} + +// #### Utilities #### +/** + * Searches the given syntax tree for an expression that ends at the given `end` offset and, + * if `start` is given, starts at the given start offset. `scope` can be given to override the + * outer scope, which defaults to the context’s top scope. Will return a `{node, state}` + * object if successful, where `node` is AST node, and `state` is the scope at that point. + * Returns `null` if unsuccessful. + */ +export function findExpressionAt(ast: ESTree.Program, start: number | undefined, end: number, scope?: Scope): { node: ESTree.Node, state: Scope } | null; +/** + * Similar to `findExpressionAt`, except that it will return the innermost expression + * node that spans the given range, rather than only exact matches. + */ +export function findExpressionAround(ast: ESTree.Program, start: number | undefined, end: number, scope?: Scope): { node: ESTree.Node, state: Scope } | null; +/** Similar to `findExpressionAround`, except that it use the same AST walker as `findExpressionAt`. */ +export function findClosestExpression(ast: ESTree.Program, start: number | undefined, end: number, scope?: Scope): { node: ESTree.Node, state: Scope } | null; +/** Determine an expression for the given node and scope (as returned by the functions above). Will return an `AVal` or plain `Type`. */ +export function expressionType(expr: { node: ESTree.Node, state: Scope | null }): AVal | Type; +/** Find the scope at a given position in the syntax tree. The `scope` parameter can be used to override the scope used for code that isn’t wrapped in any function. */ +export function scopeAt(ast: ESTree.Program, pos: number, scope?: Scope): Scope; +/** + * Will traverse the given syntax tree, using `scope` as the starting scope, looking for references to variable `name` that + * resolve to scope `refScope`, and call `f` with the node of the reference and its local scope for each of them. + */ +export function findRefs(ast: ESTree.Program, scope: Scope, name: string, refScope: Scope, f: (Node: ESTree.Node, Scope: Scope) => void): void; +/** + * Analogous to `findRefs`, but used to look for references to a specific property instead. Whereas `findRefs` + * is precise, this is dependent on type inference, and thus can not be relied on to be precise. + */ +export function findPropRefs(ast: ESTree.Program, scope: Scope, objType: Obj, propName: string, f: (Node: ESTree.Node) => void): void; +/** Whenever infer guesses a type through fuzzy heuristics (through `getType` or `expressionType`), it sets a flag. `didGuess` tests whether the guessing flag is set. */ +export function didGuess(): boolean; +/** Whenever infer guesses a type through fuzzy heuristics (through `getType` or `expressionType`), it sets a flag. `resetGuessing` resets the guessing flag. */ +export function resetGuessing(val?: boolean): void; diff --git a/node_modules/@types/tern/lib/tern/index.d.ts b/node_modules/@types/tern/lib/tern/index.d.ts new file mode 100644 index 0000000000..d866e14b61 --- /dev/null +++ b/node_modules/@types/tern/lib/tern/index.d.ts @@ -0,0 +1,500 @@ +import * as ESTree from "estree"; +import { Context, Scope, Type } from "../infer"; + +export { }; + +// #### Programming interface #### +export type ConstructorOptions = CtorOptions & (SyncConstructorOptions | ASyncConstructorOptions); + +export interface CtorOptions { + /** The definition objects to load into the server’s environment. */ + defs?: Def[]; + /** The ECMAScript version to parse. Should be either 5 or 6. Default is 6. */ + ecmaVersion?: 5 | 6; + /** Indicates the maximum amount of milliseconds to wait for an asynchronous getFile before giving up on it. Defaults to 1000. */ + fetchTimeout?: number; + /** Specifies the set of plugins that the server should load. The property names of the object name the plugins, and their values hold options that will be passed to them. */ + plugins?: { [key: string]: object }; +} + +export interface SyncConstructorOptions { + /** Indicates whether `getFile` is asynchronous. Default is `false`. */ + async?: false; + /** + * Provides a way for the server to try and fetch the content of files. + * Depending on the `async` option, this is either a function that takes a filename and returns a string (when not `async`), or + * a function that takes a `filename` and a `callback`, and calls the callback with an optional `error` as the first argument, + * and the `content` string (if no error) as the second. + */ + getFile?(filename: string): string; +} + +export interface ASyncConstructorOptions { + /** Indicates whether `getFile` is asynchronous. Default is `false`. */ + async: true; + /** + * Provides a way for the server to try and fetch the content of files. + * Depending on the `async` option, this is either a function that takes a filename and returns a string (when not `async`), or + * a function that takes a `filename` and a `callback`, and calls the callback with an optional `error` as the first argument, + * and the `content` string (if no error) as the second. + */ + getFile?(filename: string, callback: (error: Error | undefined, content?: string) => void): void; +} + +interface TernConstructor { + new(options?: ConstructorOptions): Server; +} + +export const Server: TernConstructor; + +export interface Server { + readonly cx: Context; + readonly options: ConstructorOptions; + readonly files: File[]; + readonly plugins: any; + /** + * Add a set of type definitions to the server. If `atFront` is true, they will be added before all other + * existing definitions. Otherwise, they are added at the back. + */ + addDefs(defs: Def[], atFront?: boolean): void; + + /** + * Register a file with the server. Note that files can also be included in requests. When using this + * to automatically load a dependency, specify the name of the file (as Tern knows it) as the third + * argument. That way, the file is counted towards the dependency budget of the root of its dependency graph. + */ + addFile(name: string, text?: string, parent?: string): void; + + /** Unregister a file. */ + delFile(name: string): void; + + /** + * Delete a set of type definitions from the server, by providing the name, taken from + * `defs[!name]` property from the definitions. If that property is not available in the + * current type definitions, it can’t be removed. + */ + deleteDefs(name: string): void; + + /** Forces all files to be fetched an analyzed, and then calls the callback function. */ + flush(callback: () => void): void; + + /** Load a server plugin (or don’t do anything, if the plugin is already loaded). */ + loadPlugin(name: string, options: object): void; + + /** Unregister an event handler. */ + off(eventType: K, handler: Events[K]): void; + + /** Register an event handler for the named type of event. */ + on(eventType: K, handler: Events[K]): void; + + /** + * Perform a request. `doc` is a (parsed) JSON document as described in the protocol documentation. + * The `callback` function will be called when the request completes. If an `error` occurred, + * it will be passed as a first argument. Otherwise, the `response` (parsed) JSON object will be passed as second argument. + * + * When the server hasn’t been configured to be asynchronous, the callback will be called before request returns. + */ + request( + doc: D & { query?: Q }, + callback: ( + error: string | null, + response: (D extends { query: undefined } ? {} : D extends { query: Query } ? QueryResult : {}) | undefined + ) => void + ): void; + reset(): void; + signal(event: keyof Events, file: File): void; +} + +// #### JSON Protocol #### + +export type QueryResult = QueryRegistry[Q["type"]]["result"]; + +export type Query = QueryRegistry[keyof QueryRegistry]["query"]; + +export interface QueryRegistry { + completions: { + query: CompletionsQuery, + result: CompletionsQueryResult + }; + type: { + query: TypeQuery, + result: TypeQueryResult + }; + definition: { + query: DefinitionQuery, + result: DefinitionQueryResult + }; + documentation: { + query: DocumentationQuery; + result: DocumentationQueryResult; + }; + refs: { + query: RefsQuery; + result: RefsQueryResult; + }; + rename: { + query: RenameQuery, + result: RenameQueryResult + }; + properties: { + query: PropertiesQuery, + result: PropertiesQueryResult + }; + files: { + query: FilesQuery, + result: FilesQueryResult + }; +} + +export interface Def { + [key: string]: string | Def; +} + +export interface Document { + query?: Query; + files?: File[]; + timeout?: number; +} + +export interface File { + name: string; + text: string; + scope: Scope; + ast: ESTree.Program; + type?: "full" | "part" | "delete"; + asLineChar?(nodePosition: number): Position; +} + +export interface BaseQuery { + type: string; + lineCharPositions?: boolean; + docFormat?: "full"; +} + +export interface BaseQueryWithFile extends BaseQuery { + /** may hold either a filename, or a string in the form "#N", where N should be an integer referring to one of the files included in the request */ + file: string; +} + +export interface Position { + ch: number; + line: number; +} + +/** Asks the server for a set of completions at the given point. */ +export interface CompletionsQuery extends BaseQueryWithFile { + /** Asks the server for a set of completions at the given point. */ + type: "completions"; + /** Specify the location to complete at. */ + end: number | Position; + /** Whether to include the types of the completions in the result data. Default `false` */ + types?: boolean; + /** Whether to include the distance (in scopes for variables, in prototypes for properties) between the completions and the origin position in the result data. Default `false` */ + depths?: boolean; + /** Whether to include documentation strings in the result data. Default `false` */ + docs?: boolean; + /** Whether to include urls in the result data. Default `false` */ + urls?: boolean; + /** Whether to include origin files (if found) in the result data. Default `false` */ + origins?: boolean; + /** When on, only completions that match the current word at the given point will be returned. Turn this off to get all results, so that you can filter on the client side. Default `true` */ + filter?: boolean; + /** Whether to use a case-insensitive compare between the current word and potential completions. Default `false` */ + caseInsensitive?: boolean; + /** When completing a property and no completions are found, Tern will use some heuristics to try and return some properties anyway. Set this to `false` to turn that off. Default `true` */ + guess?: boolean; + /** Determines whether the result set will be sorted. Default `true` */ + sort?: boolean; + /** + * When disabled, only the text before the given position is considered part of the word. When enabled (the default), + * the whole variable name that the cursor is on will be included. Default `true` + */ + expandWordForward?: boolean; + /** Whether to ignore the properties of `Object.prototype` unless they have been spelled out by at least two characters. Default `true` */ + omitObjectPrototype?: boolean; + /** Whether to include JavaScript keywords when completing something that is not a property. Default `false` */ + includeKeywords?: boolean; + /** If completions should be returned when inside a literal. Default `true` */ + inLiteral?: boolean; +} + +export interface CompletionsQueryResult { + /** start offsets of the word that was completed */ + start: number | Position; + /** end offsets of the word that was completed */ + end: number | Position; + /** whether the completion is for a property or a variable */ + isProperty: boolean; + // TODO depends on completionsquery settings -> conditional types? + /** + * array of completions. When one of the `types`, `depths`, `docs`, `urls`, or `origins` + * options was passed, the array will hold objects with a `name` property (the completion text), + * and, depending on the options, `type`, `depth`, `doc`, `url`, and `origin` properties. + * When none of these options are enabled, the result array will hold plain strings. + */ + completions: string[] | Array<{ + name: string, + type?: string, + depth?: number, + doc?: string, + url?: string, + origin?: string + }>; +} + +/** Query the type of something. */ +export interface TypeQuery extends BaseQueryWithFile { + /** Query the type of something. */ + type: "type"; + /** Specify the location of the expression. */ + end: number | Position; + /** Specify the location of the expression. */ + start?: number | Position; + /** + * Set to `true` when you are interested in a function type. + * This will cause function types to win when something has multiple types. + * Default `false` + */ + preferFunction?: boolean; + /** + * Determines how deep the type string must be expanded. + * Nested objects will only display property types up to this depth, + * and be represented by their type name or a representation showing + * only property names below it. Default `0` + */ + depth?: number; +} + +export interface TypeQueryResult { + /** A description of the type of the value. May be "?" when no type was found. */ + type: string; + /** Whether the given type was guessed, or should be considered reliable. */ + guess: boolean; + /** The name associated with the type. */ + name?: string; + /** When the inspected expression was an identifier or a property access, this will hold the name of the variable or property. */ + exprName?: string; + /** If the type had documentation associated with it, these will also be returned. */ + doc?: string; + /** If the type had urls associated with it, these will also be returned. */ + url?: string; + /** If the type had origin information associated with it, these will also be returned. */ + origin?: string; +} + +/** + * Asks for the definition of something. This will try, for a variable or property, + * to return the point at which it was defined. If that fails, or the chosen + * expression is not an identifier or property reference, it will try to return + * the definition site of the type the expression has. If no type is found, or the + * type is not an object or function (other types don’t store their definition site), + * it will fail to return useful information. + */ +export interface DefinitionQuery extends BaseQueryWithFile { + /** + * Asks for the definition of something. This will try, for a variable or property, + * to return the point at which it was defined. If that fails, or the chosen + * expression is not an identifier or property reference, it will try to return + * the definition site of the type the expression has. If no type is found, or the + * type is not an object or function (other types don’t store their definition site), + * it will fail to return useful information. + */ + type: "definition"; + /** Specify the location of the expression. */ + end: number | Position; + /** Specify the location of the expression. */ + start?: number | Position; +} + +export interface DefinitionQueryResult { + /** The start position of the expression. */ + start?: number | Position; + /** The end position of the expression. */ + end?: number | Position; + /** The file in which the definition was defined. */ + file?: string; + /** A slice of the code in front of the definition Can be used to find a definition’s location in a modified file. */ + context?: string; + /** The offset from the start of the context to the actual definition. Can be used to find a definition’s location in a modified file. */ + contextOffset?: number; + /** If the definition had documentation associated with it, these will also be returned. */ + doc?: string; + /** If the definition had urls associated with it, these will also be returned. */ + url?: string; + /** If the definition had origin information associated with it, these will also be returned. */ + origin?: string; +} + +/** Get the documentation string and URL for a given expression, if any. */ +export interface DocumentationQuery extends BaseQueryWithFile { + /** Get the documentation string and URL for a given expression, if any. */ + type: "documentation"; + /** Specify the location of the expression. */ + end: number | Position; + /** Specify the location of the expression. */ + start?: number | Position; +} + +export interface DocumentationQueryResult { + /** The documentation string of the definition or value, if any. */ + doc?: string; + /** The url of the definition or value, if any. */ + url?: string; + /** The origin of the definition or value, if any. */ + origin?: string; +} + +/** Used to find all references to a given variable or property. */ +export interface RefsQuery extends BaseQueryWithFile { + /** Used to find all references to a given variable or property. */ + type: "refs"; + /** Specify the location of the expression. */ + end: number | Position; + /** Specify the location of the expression. */ + start?: number | Position; +} + +export interface RefsQueryResult { + /** The name of the variable or property */ + name: string; + refs: Array<{ + file: string, + start: number | Position, + end: number | Position + }>; + /** for variables: a type property holding either "global" or "local". */ + type?: "global" | "local"; +} + +/** Rename a variable in a scope-aware way. */ +export interface RenameQuery extends BaseQueryWithFile { + /** Rename a variable in a scope-aware way. */ + type: "rename"; + /** Specify the location of the variable. */ + end: number | Position; + /** Specify the location of the variable. */ + start?: number | Position; + /** The new name of the variable */ + newName: string; +} + +/** + * Returns an object whose `changes` property holds an array of `{file, start, end, text}` objects, which + * give the changes that must be performed to apply the rename. The client is responsible for doing the actual modification. + */ +export interface RenameQueryResult { + /** Array of changes that must be performed to apply the rename. The client is responsible for doing the actual modification. */ + changes: Array<{ + file: string, + start: number | Position, + end: number | Position, + text: string + }>; +} + +/** Get a list of all known object property names (for any object). */ +export interface PropertiesQuery extends BaseQuery { + /** Get a list of all known object property names (for any object). */ + type: "properties"; + /** Causes the server to only return properties that start with the given string. */ + prefix?: string; + /** Whether the result should be sorted. Default `true` */ + sort?: boolean; +} + +export interface PropertiesQueryResult { + /** The property names. */ + completions: string[]; +} + +/** Get the files that the server currently holds in its set of analyzed files. */ +export interface FilesQuery extends BaseQuery { + /** Get the files that the server currently holds in its set of analyzed files. */ + type: "files"; + docFormat?: never; + lineCharPositions?: never; +} + +export interface FilesQueryResult { + /** The file names. */ + files: string[]; +} + +export interface Events { + /** When the server throws away its current analysis data and starts a fresh run. */ + reset(): void; + /** Before analyzing a file. file is an object holding {name, text, scope} properties. */ + beforeLoad(file: File): void; + /** After analyzing a file. */ + afterLoad(file: File): void; + /** + * Will be run right before a file is parsed, and passed the given text and options. If a handler + * returns a new text value, the origin text will be overriden. This is useful for + * instance when a plugin is able to extract JavaScript content from an HTML file. + */ + preParse(text: string, options: object): string | void; + /** Run right after a file is parsed, and passed the parse tree and the parsed file as arguments. */ + postParse(ast: ESTree.Program, text: string): void; + /** Run right before the type inference pass, passing the syntax tree and a scope object. */ + preInfer(ast: ESTree.Program, scope: Scope): void; + /** Run after the type inference pass. */ + postInfer(ast: ESTree.Program, scope: Scope): void; + /** + * Run after Tern attempts to find the type at the position end in the given file. + * A handler may return either the given type (already calculated by Tern and earlier "typeAt" passes) + * or an alternate type to be used instead. This is useful when + * a plugin can provide a more helpful type than Tern (e.g. within comments). + */ + typeAt(file: File, end: Position, expr: ESTree.Node, type: Type): Type | void; + /** Run at the start of a completion query. May return a valid completion result to replace the default completion algorithm. */ + completion(file: File, query: CompletionsQuery): CompletionsQueryResult | void; +} + +export const version: string; + +// ###### Plugins ######## + +/** + * This can be used to register an initialization function for the plugin with the given name. + * A Tern server, when configured to load this plugin, will call this initialization function, + * passing in the server instance and the options specified for the plugin (if any). This is the + * place where you register event handlers on the server, add type definitions, load other + * plugins as dependencies, and/or initialize the plugin’s state. + * + * See the server’s [list of events](http://ternjs.net/doc/manual.html#events) for ways to wire up plugin behavior. + */ +export function registerPlugin(name: string, init: (server: Server, options?: ConstructorOptions) => void): void; + +export interface Desc { + run(Server: Server, query: QueryRegistry[T]["query"], file?: File): QueryRegistry[T]["result"]; + takesFile?: boolean; +} + +/** + * Defines a new type of query with the server. The `desc` object is a property describing the request. + * It should at least have a `run` property, which holds a function fn(Server, query) that will + * be called to handle queries with a type property that matches the given `name`. It may also have + * a `takesFile` property which, if true, will cause the server to try and resolve the file on which + * the query operates (from its file property) and pass that (a {name, text, scope, ast} object) as + * a third argument to the run function. You will probably need to use the inference + * module’s API to do someting useful in this function. + * + * To be able to use this function and the `request` function in a useful way, you probably want + * to define an interface for the query and the result of the query and extend the interface `QueryRegistry` via + * [declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html) + * in the following manner: + * + * ```typescript + * declare module "tern/lib/tern" { + * interface QueryRegistry { + * [CustomQueryType]: { + * query: CustomQuery + * result: CustomQueryResult + * } + * } + * } + * ``` + * _Note that your query interface should extend_ `BaseQuery` _and that its_ `type` _property has to be spelled + * exactly like the key in the_ `QueryRegistry` _interface._ + */ +export function defineQueryType(name: T, desc: Desc): void; diff --git a/node_modules/@types/tern/package.json b/node_modules/@types/tern/package.json new file mode 100644 index 0000000000..767fd9e8c5 --- /dev/null +++ b/node_modules/@types/tern/package.json @@ -0,0 +1,26 @@ +{ + "contributors": [ + { + "githubUsername": "nkappler", + "name": "Nikolaj Kappler", + "url": "https://github.com/nkappler" + } + ], + "dependencies": { + "@types/estree": "*" + }, + "description": "TypeScript definitions for tern", + "license": "MIT", + "main": "", + "name": "@types/tern", + "repository": { + "directory": "types/tern", + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git" + }, + "scripts": {}, + "typeScriptVersion": "2.8", + "types": "index", + "typesPublisherContentHash": "7d5409b3a45afabf191a8f7207fcec4080457b7418b7ab22dea60d8e73f1d27c", + "version": "0.23.3" +} diff --git a/node_modules/karma-coverage/package.json b/node_modules/karma-coverage/package.json index 475bae33a9..2ede22c2a1 100644 --- a/node_modules/karma-coverage/package.json +++ b/node_modules/karma-coverage/package.json @@ -1,240 +1,63 @@ { - "author": { - "email": "ryushi@gmail.com", - "name": "SATO taichi" - }, - "bugs": { - "url": "https://github.com/karma-runner/karma-coverage/issues" - }, + "author": "SATO taichi ", "contributors": [ - { - "email": "dignifiedquire@gmail.com", - "name": "dignifiedquire" - }, - { - "email": "dignifiedquire@gmail.com", - "name": "Friedel Ziegelmayer" - }, - { - "email": "aymeric@beaumet.me", - "name": "Aymeric Beaumet" - }, - { - "email": "johnjbarton@johnjbarton.com", - "name": "johnjbarton" - }, - { - "email": "mark@zzo.com", - "name": "Mark Ethan Trostler" - }, - { - "email": "timkang@ucla.edu", - "name": "Tim Kang" - }, - { - "email": "hicom150@gmail.com", - "name": "hicom150" - }, - { - "email": "nmalaguti@palantir.com", - "name": "Nick Malaguti" - }, - { - "email": "rv.maksim@gmail.com", - "name": "Maksim Ryzhikov" - }, - { - "email": "mark@zzo.com", - "name": "Mark Trostler" - }, - { - "email": "jansennico@gmail.com", - "name": "nicojs" - }, - { - "email": "tkrotoff@gmail.com", - "name": "Tanguy Krotoff" - }, - { - "email": "weikin.huang04@gmail.com", - "name": "Wei Kin Huang" - }, - { - "email": "douglasduteil@gmail.com", - "name": "Douglas Duteil" - }, - { - "email": "m_winche@yahoo.com", - "name": "Matt Winchester" - }, - { - "email": "hicom150@gmail.com", - "name": "Julen Garcia Leunda" - }, - { - "email": "abierbaum@gmail.com", - "name": "Allen Bierbaum" - }, - { - "email": "michael.noack@sealink.com.au", - "name": "Michael Noack" - }, - { - "email": "m.stramel89@gmail.com", - "name": "Michael Stramel" - }, - { - "email": "nick.matantsev@gmail.com", - "name": "Nick Matantsev" - }, - { - "email": "petar.manev2010@gmail.com", - "name": "Petar Manev" - }, - { - "email": "robinboehm@googlemail.com", - "name": "Robin B\u00f6hm" - }, - { - "email": "ron.derksen@informaat.nl", - "name": "Ron Derksen" - }, - { - "email": "ruben.bridgewater@fintura.de", - "name": "Ruben Bridgewater" - }, - { - "email": "sakhat@gmail.com", - "name": "Sahat Yalkabov" - }, - { - "email": "dhanwada.dev@gmail.com", - "name": "Srinivas Dhanwada" - }, - { - "email": "expheno@gmail.com", - "name": "Tanjo, Hiroyuki" - }, - { - "email": "taylor@taylorhakes.com", - "name": "Taylor Hakes" - }, - { - "email": "tmcgann@users.noreply.github.com", - "name": "Taylor McGann" - }, - { - "email": "krinklemail@gmail.com", - "name": "Timo Tijhof" - }, - { - "email": "tom@systemseed.com", - "name": "Tom Kirkpatrick" - }, - { - "email": "tyler.waters@gmail.com", - "name": "Tyler Waters" - }, - { - "email": "vincent.lemeunier+git@gmail.com", - "name": "Vincent Lemeunier" - }, - { - "email": "utatane.tea@gmail.com", - "name": "Yusuke Suzuki" - }, - { - "email": "alexander.prooks@gmail.com", - "name": "aprooks" - }, - { - "email": "cafesanu@gmail.com", - "name": "carlos" - }, - { - "email": "fbergr@gmail.com", - "name": "fbergr" - }, - { - "email": "piecyk@gmail.com", - "name": "piecyk" - }, - { - "email": "adam-h@users.noreply.github.com", - "name": "Adam Heath" - }, - { - "email": "terussell85@gmail.com", - "name": "terussell85" - }, - { - "email": "AndrewLane@users.noreply.github.com", - "name": "Andrew Lane" - }, - { - "email": "chris.m.gladd@gmail.com", - "name": "Chris Gladd" - }, - { - "email": "cletusw@gmail.com", - "name": "Clayton Watts" - }, - { - "email": "dan@synaptik.com", - "name": "Dan Watling" - }, - { - "email": "diogo.nicoleti@gmail.com", - "name": "Diogo Nicoleti" - }, - { - "email": "dpetroff@gmail.com", - "name": "Dmitry Petrov" - }, - { - "email": "gvarsanyi@gmail.com", - "name": "Greg Varsanyi" - }, - { - "email": "ian.j.rufus@gmail.com", - "name": "Ian Rufus" - }, - { - "email": "james@talmage.io", - "name": "James Talmage" - }, - { - "email": "joec@avinetworks.com", - "name": "Joseph Connolly" - }, - { - "email": "jappelman@xebia.com", - "name": "Joshua Appelman" - }, - { - "email": "ju.ralph@gmail.com", - "name": "Julie" - }, - { - "email": "kyle@mekyle.com", - "name": "Kyle Welsby" - }, - { - "email": "lloyd@trove.com", - "name": "Lloyd Smith II" - }, - { - "email": "maciej.rzepinski@gmail.com", - "name": "Maciej Rzepin\u0301ski" - }, - { - "email": "me@marceli.no", - "name": "Marceli.no" - }, - { - "email": "matthew.lewis@socialsignin.co.uk", - "name": "Matt Lewis" - } + "dignifiedquire ", + "Friedel Ziegelmayer ", + "Aymeric Beaumet ", + "johnjbarton ", + "Mark Ethan Trostler ", + "Tim Kang ", + "hicom150 ", + "Nick Malaguti ", + "Maksim Ryzhikov ", + "Mark Trostler ", + "nicojs ", + "Tanguy Krotoff ", + "Wei Kin Huang ", + "Douglas Duteil ", + "Matt Winchester ", + "Julen Garcia Leunda ", + "Allen Bierbaum ", + "Michael Noack ", + "Michael Stramel ", + "Nick Matantsev ", + "Petar Manev ", + "Robin B\u00f6hm ", + "Ron Derksen ", + "Ruben Bridgewater ", + "Sahat Yalkabov ", + "Srinivas Dhanwada ", + "Tanjo, Hiroyuki ", + "Taylor Hakes ", + "Taylor McGann ", + "Timo Tijhof ", + "Tom Kirkpatrick ", + "Tyler Waters ", + "Vincent Lemeunier ", + "Yusuke Suzuki ", + "aprooks ", + "carlos ", + "fbergr ", + "piecyk ", + "Adam Heath ", + "terussell85 ", + "Andrew Lane ", + "Chris Gladd ", + "Clayton Watts ", + "Dan Watling ", + "Diogo Nicoleti ", + "Dmitry Petrov ", + "Greg Varsanyi ", + "Ian Rufus ", + "James Talmage ", + "Joseph Connolly ", + "Joshua Appelman ", + "Julie ", + "Kyle Welsby ", + "Lloyd Smith II ", + "Maciej Rzepin\u0301ski ", + "Marceli.no ", + "Matt Lewis " ], "dependencies": { "istanbul-lib-coverage": "^3.0.0", @@ -277,7 +100,6 @@ "engines": { "node": ">=10.0.0" }, - "homepage": "https://github.com/karma-runner/karma-coverage#readme", "keywords": [ "karma-plugin", "karma-preprocessor", diff --git a/node_modules/lodash/package.json b/node_modules/lodash/package.json index 6dc2c71eb5..3d34f965ee 100644 --- a/node_modules/lodash/package.json +++ b/node_modules/lodash/package.json @@ -1,38 +1,17 @@ { - "author": { - "email": "john.david.dalton@gmail.com", - "name": "John-David Dalton" - }, - "bugs": { - "url": "https://github.com/lodash/lodash/issues" - }, - "bundleDependencies": false, + "author": "John-David Dalton ", "contributors": [ - { - "email": "john.david.dalton@gmail.com", - "name": "John-David Dalton" - }, - { - "email": "mathias@qiwi.be", - "name": "Mathias Bynens" - } + "John-David Dalton ", + "Mathias Bynens " ], - "deprecated": false, "description": "Lodash modular utilities.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", - "keywords": [ - "modules", - "stdlib", - "util" - ], + "keywords": "modules, stdlib, util", "license": "MIT", "main": "lodash.js", "name": "lodash", - "repository": { - "type": "git", - "url": "git+https://github.com/lodash/lodash.git" - }, + "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash-archive/lodash-cli for testing details.\"" }, diff --git a/package-lock.json b/package-lock.json index def0891278..0e7f479706 100644 --- a/package-lock.json +++ b/package-lock.json @@ -753,6 +753,15 @@ "integrity": "sha512-zw8UvoBEImn392tLjxoavuonblX/4Yb9ha4KBU10FirCfwgzhKO0dvyJSF9ByxV1xK1r2AgnAi/tvQaLgxQqxA==", "dev": true }, + "@types/codemirror": { + "version": "0.0.97", + "resolved": "https://registry.npmjs.org/@types/codemirror/-/codemirror-0.0.97.tgz", + "integrity": "sha512-n5d7o9nWhC49DjfhsxANP7naWSeTzrjXASkUDQh7626sM4zK9XP2EVcHp1IcCf/IPV6c7ORzDUDF3Bkt231VKg==", + "dev": true, + "requires": { + "@types/tern": "*" + } + }, "@types/color-name": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", @@ -831,6 +840,15 @@ "@types/node": "*" } }, + "@types/tern": { + "version": "0.23.3", + "resolved": "https://registry.npmjs.org/@types/tern/-/tern-0.23.3.tgz", + "integrity": "sha512-imDtS4TAoTcXk0g7u4kkWqedB3E4qpjXzCpD2LU5M5NAXHzCDsypyvXSaG7mM8DKYkCRa7tFp4tS/lp/Wo7Q3w==", + "dev": true, + "requires": { + "@types/estree": "*" + } + }, "@types/unist": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.3.tgz", diff --git a/scripts/deps/manage_node_deps.py b/scripts/deps/manage_node_deps.py index 163d9c1c80..8ffae871fe 100755 --- a/scripts/deps/manage_node_deps.py +++ b/scripts/deps/manage_node_deps.py @@ -37,6 +37,7 @@ LICENSES = [ DEPS = { "@rollup/plugin-commonjs": "13.0.0", "@types/chai": "4.2.0", + "@types/codemirror": "0.0.97", "@types/estree": "0.0.45", "@types/filesystem": "0.0.29", "@types/mocha": "5.2.7",