@types/codemirror

  • Version 5.60.15
  • Published
  • 154 kB
  • 1 dependency
  • MIT license

Install

npm i @types/codemirror
yarn add @types/codemirror
pnpm add @types/codemirror

Overview

TypeScript definitions for codemirror

Index

Variables

Functions

Classes

Interfaces

Type Aliases

Namespaces

Variables

variable commands

const commands: CommandActions;
  • 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.

variable defaults

const defaults: { [option: string]: any };
  • 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).

variable Doc

const Doc: DocConstructor;

    variable fold

    const fold: FoldHelpers;

      variable hint

      const hint: HintHelpers;

        variable htmlSchema

        const htmlSchema: any;

          variable MergeView

          const MergeView: MergeViewConstructor;

            variable mimeModes

            const mimeModes: MimeModeMap;
            • Maps MIME types to mode specs.

            variable modeInfo

            const modeInfo: ModeInfo[];

              variable modes

              const modes: ModeMap;
              • Maps mode names to their constructors

              variable modeURL

              let modeURL: string;

                variable Pass

                const Pass: { toString(): 'CodeMirror.PASS' };

                  variable Pos

                  const Pos: PositionConstructor;

                    variable scrollbarModel

                    const scrollbarModel: ScrollbarModels;

                      variable version

                      const version: string;
                      • 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.

                      Functions

                      function autoLoadMode

                      autoLoadMode: (
                      instance: Editor,
                      mode: string,
                      options?: RequireModeOptions
                      ) => void;

                        function changeEnd

                        changeEnd: (change: EditorChange) => Position;
                        • 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 cmpPos

                        cmpPos: (a: Position, b: Position) => number;
                        • Compare two positions, return 0 if they are the same, a negative number when a is less, and a positive number otherwise.

                        function CodeMirror

                        CodeMirror: typeof import('/index.d.ts');

                          function colorize

                          colorize: (collection?: ArrayLike<Element>, defaultMode?: string) => void;
                          • Provides a convenient way to syntax-highlight code snippets in a webpage. Depends on the runmode addon (or its standalone variant). Can be called with an array (or other array-ish collection) of DOM nodes that represent the code snippets. By default, it'll get all pre tags. Will read the data-lang attribute of these nodes to figure out their language, and syntax-color their content using the relevant CodeMirror mode (you'll have to load the scripts for the relevant modes yourself). A second argument may be provided to give a default mode, used when no language attribute is found for a node.

                          function countColumn

                          countColumn: (line: string, index: number | null, tabSize: number) => number;
                          • Find the column position at a given string index using a given tabsize.

                          function defineDocExtension

                          defineDocExtension: (name: string, value: any) => void;
                          • Like defineExtension, but the method will be added to the interface for Doc objects instead.

                          function defineExtension

                          defineExtension: (name: string, value: any) => void;
                          • 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 defineInitHook

                          defineInitHook: (func: (editor: Editor) => void) => void;
                          • If your extension 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 defineMIME

                          defineMIME: (mime: string, modeSpec: string | ModeSpec<ModeSpecOptions>) => void;

                            function defineMode

                            defineMode: (id: string, modefactory: ModeFactory<any>) => 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 defineOption

                            defineOption: (
                            name: string,
                            default_: any,
                            updateFunc: (editor: Editor, val: any, old: any) => void
                            ) => 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 defineSimpleMode

                            defineSimpleMode: <K extends string>(
                            name: string,
                            mode: { [P in K]: P extends 'meta' ? Record<string, any> : Rule[] } & {
                            start: Rule[];
                            }
                            ) => void;

                              function extendMode

                              extendMode: (name: string, properties: Partial<Mode<any>>) => void;
                              • 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 findEnclosingTag

                              findEnclosingTag: (
                              cm: Editor,
                              pos: Position,
                              range: Range,
                              tag: string
                              ) => { open: XmlTag; close: XmlTag } | undefined;

                                function findMatchingTag

                                findMatchingTag: (
                                cm: Editor,
                                pos: Position,
                                range: Range
                                ) =>
                                | { open: XmlTag; close: XmlTag | null | undefined; at: 'open' | 'close' }
                                | undefined;

                                  function findModeByExtension

                                  findModeByExtension: (ext: string) => ModeInfo | undefined;

                                    function findModeByFileName

                                    findModeByFileName: (filename: string) => ModeInfo | undefined;

                                      function findModeByMIME

                                      findModeByMIME: (mime: string) => ModeInfo | undefined;

                                        function findModeByName

                                        findModeByName: (name: string) => ModeInfo | undefined;

                                          function fromTextArea

                                          fromTextArea: (
                                          host: HTMLTextAreaElement,
                                          options?: EditorConfiguration
                                          ) => EditorFromTextArea;

                                            function getMode

                                            getMode: (
                                            config: EditorConfiguration,
                                            mode: string | ModeSpec<ModeSpecOptions>
                                            ) => Mode<unknown>;
                                            • 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 innerMode

                                            innerMode: (mode: Mode<any>, state: any) => { state: any; mode: Mode<any> };
                                            • Given a state object, returns a {state, mode} object with the inner mode and its state for the current position.

                                            function isWordChar

                                            isWordChar: (ch: string) => boolean;
                                            • Check if a char is part of an alphabet.

                                            function multiplexingMode

                                            multiplexingMode: (
                                            outer: Mode<any>,
                                            ...others: MultiplexedInnerMode[]
                                            ) => Mode<any>;
                                            • Mode combinator that can be used to easily 'multiplex' between several modes. When given as first argument a mode object, and as other arguments any number of {open, close, mode [, delimStyle, innerStyle, parseDelimiters]} objects, it will return a mode object that starts parsing using the mode passed as first argument, but will switch to another mode as soon as it encounters a string that occurs in one of the open fields of the passed objects. When in a sub-mode, it will go back to the top mode again when the close string is encountered. Pass "\n" for open or close if you want to switch on a blank line.

                                              When delimStyle is specified, it will be the token style returned for the delimiter tokens (as well as [delimStyle]-open on the opening token and [delimStyle]-close on the closing token). When innerStyle is specified, it will be the token style added for each inner mode token. When parseDelimiters is true, the content of the delimiters will also be passed to the inner mode. (And delimStyle is ignored.)

                                              The outer mode will not see the content between the delimiters.

                                            function normalizeKeyMap

                                            normalizeKeyMap: (km: KeyMap) => KeyMap;
                                            • Modify a keymap to normalize modifier order and properly recognize multi-stroke bindings.

                                            function off

                                            off: {
                                            <T extends keyof DocEventMap>(
                                            doc: Doc,
                                            eventName: T,
                                            handler: DocEventMap[T]
                                            ): void;
                                            <T extends keyof EditorEventMap>(
                                            cm: Editor,
                                            eventName: T,
                                            handler: EditorEventMap[T]
                                            ): void;
                                            <T extends keyof LineHandleEventMap>(
                                            lineHandle: LineHandle,
                                            eventName: T,
                                            handler: LineHandleEventMap[T]
                                            ): void;
                                            <T extends keyof TextMarkerEventMap>(
                                            textMarker: TextMarker<unknown>,
                                            eventName: T,
                                            handler: TextMarkerEventMap[T]
                                            ): void;
                                            <T extends 'redraw'>(
                                            lineWidget: LineWidget,
                                            eventName: T,
                                            handler: LineWidgetEventMap[T]
                                            ): void;
                                            (element: any, eventName: string, handler: () => void): void;
                                            <T extends keyof CompletionEventMap>(
                                            hints: Hints,
                                            eventName: T,
                                            handler: CompletionEventMap[T]
                                            ): void;
                                            };

                                              function on

                                              on: {
                                              <T extends keyof DocEventMap>(
                                              doc: Doc,
                                              eventName: T,
                                              handler: DocEventMap[T]
                                              ): void;
                                              <T extends keyof EditorEventMap>(
                                              cm: Editor,
                                              eventName: T,
                                              handler: EditorEventMap[T]
                                              ): void;
                                              <T extends keyof LineHandleEventMap>(
                                              lineHandle: LineHandle,
                                              eventName: T,
                                              handler: LineHandleEventMap[T]
                                              ): void;
                                              <T extends keyof TextMarkerEventMap>(
                                              textMarker: TextMarker<unknown>,
                                              eventName: T,
                                              handler: TextMarkerEventMap[T]
                                              ): void;
                                              <T extends 'redraw'>(
                                              LineWidget: LineWidget,
                                              eventName: T,
                                              handler: LineWidgetEventMap[T]
                                              ): void;
                                              (element: any, eventName: string, handler: () => void): void;
                                              <T extends keyof CompletionEventMap>(
                                              hints: Hints,
                                              eventName: T,
                                              handler: CompletionEventMap[T]
                                              ): void;
                                              };

                                                function overlayMode

                                                overlayMode: {
                                                (base: Mode<any>, overlay: Mode<any>, combine?: boolean): Mode<any>;
                                                (base: Mode<any>, overlay: Mode<any>, combine?: boolean): Mode<any>;
                                                };
                                                • 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 registerHelper

                                                registerHelper: (namespace: string, name: string, helper: any) => 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 requireMode

                                                requireMode: (
                                                mode: string | { name: string },
                                                callback: () => void,
                                                options?: RequireModeOptions
                                                ) => void;

                                                  function runMode

                                                  runMode: (
                                                  text: string,
                                                  mode: string | ModeSpec<unknown>,
                                                  callback:
                                                  | HTMLElement
                                                  | ((
                                                  text: string,
                                                  style?: string | null,
                                                  row?: number,
                                                  column?: number,
                                                  state?: any
                                                  ) => void),
                                                  options?: { tabSize?: number | undefined; state?: any }
                                                  ) => void;
                                                  • Runs a CodeMirror mode over text without opening an editor instance.

                                                    Parameter text

                                                    The document to run through the highlighter.

                                                    Parameter mode

                                                    The mode to use (must be loaded as normal).

                                                    Parameter callback

                                                    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 scanForClosingTag

                                                  scanForClosingTag: (
                                                  cm: Editor,
                                                  pos: Position,
                                                  name: string,
                                                  end?: Position
                                                  ) => XmlTag | null | undefined;

                                                    function showHint

                                                    showHint: (cm: Editor, hinter?: HintFunction, options?: ShowHintOptions) => void;
                                                    • 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 signal

                                                    signal: {
                                                    <T extends keyof DocEventMap>(
                                                    doc: Doc,
                                                    eventName: T,
                                                    ...args: Parameters<DocEventMap[T]>
                                                    ): void;
                                                    <T extends keyof EditorEventMap>(
                                                    cm: Editor,
                                                    eventName: T,
                                                    ...args: Parameters<EditorEventMap[T]>
                                                    ): void;
                                                    <T extends keyof LineHandleEventMap>(
                                                    lineHandle: LineHandle,
                                                    eventName: T,
                                                    ...args: Parameters<LineHandleEventMap[T]>
                                                    ): void;
                                                    <T extends keyof TextMarkerEventMap>(
                                                    textMarker: TextMarker<unknown>,
                                                    eventName: T,
                                                    ...args: Parameters<TextMarkerEventMap[T]>
                                                    ): void;
                                                    <T extends 'redraw'>(
                                                    lineWidget: LineWidget,
                                                    eventName: T,
                                                    ...args: Parameters<LineWidgetEventMap[T]>
                                                    ): void;
                                                    (target: any, name: string, ...args: any[]): void;
                                                    <T extends keyof CompletionEventMap>(
                                                    hints: Hints,
                                                    eventName: T,
                                                    ...args: Parameters<CompletionEventMap[T]>
                                                    ): 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 splitLines

                                                    splitLines: (text: string) => string[];
                                                    • Split a string by new line.

                                                    function startState

                                                    startState: <T>(mode: Mode<T>, a1?: any, a2?: any) => T | boolean;
                                                    • Call startState of the mode if available, otherwise return true

                                                    Classes

                                                    class StringStream

                                                    class StringStream {}

                                                      constructor

                                                      constructor(text: string);

                                                        property lastColumnPos

                                                        lastColumnPos: number;

                                                          property lastColumnValue

                                                          lastColumnValue: number;

                                                            property lineStart

                                                            lineStart: number;

                                                              property pos

                                                              pos: number;
                                                              • Current position in the string.

                                                              property start

                                                              start: number;
                                                              • Where the stream's position was when it was first passed to the token function.

                                                              property string

                                                              string: string;
                                                              • The current line's content.

                                                              property tabSize

                                                              tabSize: number;
                                                              • Number of spaces per tab character.

                                                              method backUp

                                                              backUp: (n: number) => void;
                                                              • 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.

                                                              method column

                                                              column: () => number;
                                                              • Returns the column (taking into account tabs) at which the current token starts.

                                                              method current

                                                              current: () => string;
                                                              • Get the string between the start of the current token and the current stream position.

                                                              method eat

                                                              eat: (match: string | RegExp | ((char: string) => boolean)) => string;
                                                              • 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.

                                                              method eatSpace

                                                              eatSpace: () => boolean;
                                                              • Shortcut for eatWhile when matching white-space.

                                                              method eatWhile

                                                              eatWhile: (match: string | RegExp | ((char: string) => boolean)) => boolean;
                                                              • Repeatedly calls eat with the given argument, until it fails. Returns true if any characters were eaten.

                                                              method eol

                                                              eol: () => boolean;
                                                              • Returns true only if the stream is at the end of the line.

                                                              method indentation

                                                              indentation: () => number;
                                                              • Tells you how far the current line has been indented, in spaces. Corrects for tab characters.

                                                              method lookAhead

                                                              lookAhead: (n: number) => string | undefined;
                                                              • Returns the content of the line n lines ahead in the stream without advancing it. Will return undefined if not found.

                                                              method match

                                                              match: {
                                                              (pattern: string, consume?: boolean, caseFold?: boolean): boolean;
                                                              (pattern: RegExp, consume?: boolean): string[];
                                                              };
                                                              • 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.

                                                              method next

                                                              next: () => string | null;
                                                              • Returns the next character in the stream and advances it. Also returns null when no more characters are available.

                                                              method peek

                                                              peek: () => string | null;
                                                              • Returns the next character in the stream without advancing it. Will return an null at the end of the line.

                                                              method skipTo

                                                              skipTo: (ch: string) => boolean;
                                                              • 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.

                                                              method skipToEnd

                                                              skipToEnd: () => void;
                                                              • Moves the position to the end of the line.

                                                              method sol

                                                              sol: () => boolean;
                                                              • Returns true only if the stream is at the start of the line.

                                                              class TernServer

                                                              class TernServer {}

                                                                constructor

                                                                constructor(options?: TernOptions);

                                                                  property docs

                                                                  readonly docs: {
                                                                  readonly [key: string]: {
                                                                  doc: Doc;
                                                                  name: string;
                                                                  changed: { from: number; to: number } | null;
                                                                  };
                                                                  };

                                                                    property options

                                                                    readonly options: TernOptions;

                                                                      property server

                                                                      readonly server: Tern.Server;

                                                                        method addDoc

                                                                        addDoc: (
                                                                        name: string,
                                                                        doc: Doc
                                                                        ) => { doc: Doc; name: string; changed: { from: number; to: number } | null };

                                                                          method complete

                                                                          complete: (cm: Editor) => void;

                                                                            method delDoc

                                                                            delDoc: (id: string | Editor | Doc) => void;

                                                                              method destroy

                                                                              destroy: () => void;

                                                                                method hideDoc

                                                                                hideDoc: (id: string | Editor | Doc) => void;

                                                                                  method jumpBack

                                                                                  jumpBack: (cm: Editor) => void;

                                                                                    method jumpToDef

                                                                                    jumpToDef: (cm: Editor) => void;

                                                                                      method rename

                                                                                      rename: (cm: Editor) => void;

                                                                                        method request

                                                                                        request: {
                                                                                        <Q extends Tern.Query>(
                                                                                        cm: Doc,
                                                                                        query: Q,
                                                                                        callback: (error?: Error, data?: Tern.QueryResult<Q>) => void,
                                                                                        pos?: Position
                                                                                        ): void;
                                                                                        <Q extends Tern.Query>(
                                                                                        cm: Doc,
                                                                                        query: Q,
                                                                                        callback: (error?: Error, data?: Tern.QueryRegistry) => void,
                                                                                        pos?: Position
                                                                                        ): void;
                                                                                        };

                                                                                          method selectName

                                                                                          selectName: (cm: Editor) => void;

                                                                                            method showDocs

                                                                                            showDocs: (cm: Editor, pos?: Position, callback?: () => void) => void;

                                                                                              method showType

                                                                                              showType: (cm: Editor, pos?: Position, callback?: () => void) => void;

                                                                                                method updateArgHints

                                                                                                updateArgHints: (cm: Editor) => void;

                                                                                                  Interfaces

                                                                                                  interface AsyncHintFunction

                                                                                                  interface AsyncHintFunction {}

                                                                                                    property async

                                                                                                    async: true;

                                                                                                      call signature

                                                                                                      (
                                                                                                      cm: Editor,
                                                                                                      callback: (hints: Hints | null | undefined) => void,
                                                                                                      options: ShowHintOptions
                                                                                                      ): void;

                                                                                                        interface AutoCloseBrackets

                                                                                                        interface AutoCloseBrackets {}

                                                                                                          property closeBefore

                                                                                                          closeBefore?: string | undefined;
                                                                                                          • If the next character is in the string, opening a bracket should be auto-closed.

                                                                                                          property explode

                                                                                                          explode?: string | undefined;
                                                                                                          • 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.

                                                                                                          property override

                                                                                                          override?: boolean | undefined;
                                                                                                          • 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.

                                                                                                          property pairs

                                                                                                          pairs?: string | undefined;
                                                                                                          • String containing pairs of matching characters.

                                                                                                          property triples

                                                                                                          triples?: string | undefined;
                                                                                                          • String containing chars that could do a triple quote.

                                                                                                          interface AutoCloseTags

                                                                                                          interface AutoCloseTags {}

                                                                                                            property dontCloseTags

                                                                                                            dontCloseTags?: readonly string[] | undefined;
                                                                                                            • An array of tag names that should not be autoclosed. (default is empty tags for HTML, none for XML)

                                                                                                            property emptyTags

                                                                                                            emptyTags: readonly string[];
                                                                                                            • An array of XML tag names that should be autoclosed with '/>'. (default is none)

                                                                                                            property indentTags

                                                                                                            indentTags?: readonly string[] | undefined;
                                                                                                            • 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)

                                                                                                            property whenClosing

                                                                                                            whenClosing?: boolean | undefined;
                                                                                                            • Whether to autoclose when the '/' of a closing tag is typed. (default true)

                                                                                                            property whenOpening

                                                                                                            whenOpening?: boolean | undefined;
                                                                                                            • Whether to autoclose the tag when the final '>' of an opening tag is typed. (default true)

                                                                                                            interface CommandActions

                                                                                                            interface CommandActions {}

                                                                                                              method defaultTabTab

                                                                                                              defaultTabTab: (cm: Editor) => void;
                                                                                                              • If something is selected, indent it by one indent unit. If nothing is selected, insert a tab character.

                                                                                                              method delCharAfter

                                                                                                              delCharAfter: (cm: Editor) => void;
                                                                                                              • Delete the character after the cursor.

                                                                                                              method delCharBefore

                                                                                                              delCharBefore: (cm: Editor) => void;
                                                                                                              • Delete the character before the cursor.

                                                                                                              method deleteLine

                                                                                                              deleteLine: (cm: Editor) => void;
                                                                                                              • Deletes the whole line under the cursor, including newline at the end.

                                                                                                              method delGroupAfter

                                                                                                              delGroupAfter: (cm: Editor) => void;
                                                                                                              • Delete to the start of the group after the cursor.

                                                                                                              method delGroupBefore

                                                                                                              delGroupBefore: (cm: Editor) => void;
                                                                                                              • Delete to the left of the group before the cursor.

                                                                                                              method delLineLeft

                                                                                                              delLineLeft: (cm: Editor) => void;
                                                                                                              • Delete the part of the line before the cursor.

                                                                                                              method delWordAfter

                                                                                                              delWordAfter: (cm: Editor) => void;
                                                                                                              • Delete up to the end of the word after the cursor.

                                                                                                              method delWordBefore

                                                                                                              delWordBefore: (cm: Editor) => void;
                                                                                                              • Delete up to the start of the word before the cursor.

                                                                                                              method delWrappedLineLeft

                                                                                                              delWrappedLineLeft: (cm: Editor) => void;
                                                                                                              • Delete the part of the line from the left side of the visual line the cursor is on to the cursor.

                                                                                                              method delWrappedLineRight

                                                                                                              delWrappedLineRight: (cm: Editor) => void;
                                                                                                              • Delete the part of the line from the cursor to the right side of the visual line the cursor is on.

                                                                                                              method goCharLeft

                                                                                                              goCharLeft: (cm: Editor) => void;
                                                                                                              • Move the cursor one character left, going to the previous line when hitting the start of line.

                                                                                                              method goCharRight

                                                                                                              goCharRight: (cm: Editor) => void;
                                                                                                              • Move the cursor one character right, going to the next line when hitting the end of line.

                                                                                                              method goColumnLeft

                                                                                                              goColumnLeft: (cm: Editor) => void;
                                                                                                              • Move the cursor one character left, but don't cross line boundaries.

                                                                                                              method goColumnRight

                                                                                                              goColumnRight: (cm: Editor) => void;
                                                                                                              • Move the cursor one character right, don't cross line boundaries.

                                                                                                              method goDocEnd

                                                                                                              goDocEnd: (cm: Editor) => void;
                                                                                                              • Move the cursor to the end of the document.

                                                                                                              method goDocStart

                                                                                                              goDocStart: (cm: Editor) => void;
                                                                                                              • Move the cursor to the start of the document.

                                                                                                              method goGroupLeft

                                                                                                              goGroupLeft: (cm: 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.

                                                                                                              method goGroupRight

                                                                                                              goGroupRight: (cm: Editor) => void;
                                                                                                              • Move to the right of the group after the cursor (see above).

                                                                                                              method goLineDown

                                                                                                              goLineDown: (cm: Editor) => void;
                                                                                                              • Move down one line.

                                                                                                              method goLineEnd

                                                                                                              goLineEnd: (cm: Editor) => void;
                                                                                                              • Move the cursor to the end of the line.

                                                                                                              method goLineLeft

                                                                                                              goLineLeft: (cm: 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.

                                                                                                              method goLineLeftSmart

                                                                                                              goLineLeftSmart: (cm: 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.

                                                                                                              method goLineRight

                                                                                                              goLineRight: (cm: Editor) => void;
                                                                                                              • Move the cursor to the right side of the visual line it is on.

                                                                                                              method goLineStart

                                                                                                              goLineStart: (cm: Editor) => void;
                                                                                                              • Move the cursor to the start of the line.

                                                                                                              method goLineStartSmart

                                                                                                              goLineStartSmart: (cm: 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).

                                                                                                              method goLineUp

                                                                                                              goLineUp: (cm: Editor) => void;
                                                                                                              • Move the cursor up one line.

                                                                                                              method goPageDown

                                                                                                              goPageDown: (cm: Editor) => void;
                                                                                                              • Move the cursor down one screen, and scroll down by the same distance.

                                                                                                              method goPageUp

                                                                                                              goPageUp: (cm: Editor) => void;
                                                                                                              • Move the cursor up one screen, and scroll up by the same distance.

                                                                                                              method goWordLeft

                                                                                                              goWordLeft: (cm: Editor) => void;
                                                                                                              • Move the cursor to the start of the previous word.

                                                                                                              method goWordRight

                                                                                                              goWordRight: (cm: Editor) => void;
                                                                                                              • Move the cursor to the end of the next word.

                                                                                                              method indentAuto

                                                                                                              indentAuto: (cm: Editor) => void;
                                                                                                              • Auto-indent the current line or selection.

                                                                                                              method indentLess

                                                                                                              indentLess: (cm: Editor) => void;
                                                                                                              • Dedent the current line or selection by one indent unit.

                                                                                                              method indentMore

                                                                                                              indentMore: (cm: Editor) => void;
                                                                                                              • Indent the current line or selection by one indent unit.

                                                                                                              method insertSoftTab

                                                                                                              insertSoftTab: (cm: Editor) => void;
                                                                                                              • Insert the amount of spaces that match the width a tab at the cursor position would have.

                                                                                                              method insertTab

                                                                                                              insertTab: (cm: Editor) => void;
                                                                                                              • Insert a tab character at the cursor.

                                                                                                              method killLine

                                                                                                              killLine: (cm: 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.

                                                                                                              method newlineAndIndent

                                                                                                              newlineAndIndent: (cm: Editor) => void;
                                                                                                              • Insert a newline and auto-indent the new line.

                                                                                                              method redo

                                                                                                              redo: (cm: Editor) => void;
                                                                                                              • Redo the last undone change.

                                                                                                              method redoSelection

                                                                                                              redoSelection: (cm: Editor) => void;
                                                                                                              • Redo the last change to the selection, or the last text change if no selection changes remain.

                                                                                                              method selectAll

                                                                                                              selectAll: (cm: Editor) => void;
                                                                                                              • Select the whole content of the editor.

                                                                                                              method singleSelection

                                                                                                              singleSelection: (cm: Editor) => void;
                                                                                                              • When multiple selections are present, this deselects all but the primary selection.

                                                                                                              method toggleOverwrite

                                                                                                              toggleOverwrite: (cm: Editor) => void;
                                                                                                              • Flip the overwrite flag.

                                                                                                              method transposeChars

                                                                                                              transposeChars: (cm: Editor) => void;
                                                                                                              • Swap the characters before and after the cursor.

                                                                                                              method undo

                                                                                                              undo: (cm: 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.

                                                                                                              method undoSelection

                                                                                                              undoSelection: (cm: 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.

                                                                                                              interface CommandActions

                                                                                                              interface CommandActions {}

                                                                                                                method toggleComment

                                                                                                                toggleComment: (cm: Editor) => void;

                                                                                                                  interface CommandActions

                                                                                                                  interface CommandActions {}

                                                                                                                    method closeTag

                                                                                                                    closeTag: (cm: Editor) => void;

                                                                                                                      interface CommandActions

                                                                                                                      interface CommandActions {}

                                                                                                                        method newlineAndIndentContinueMarkdownList

                                                                                                                        newlineAndIndentContinueMarkdownList: (cm: Editor) => void | typeof Pass;

                                                                                                                          interface CommandActions

                                                                                                                          interface CommandActions {}

                                                                                                                            method toMatchingTag

                                                                                                                            toMatchingTag: (cm: Editor) => void;
                                                                                                                            • You can bind a key to in order to jump to the tag matching the one under the cursor.

                                                                                                                            interface CommandActions

                                                                                                                            interface CommandActions {}

                                                                                                                              method fold

                                                                                                                              fold: (cm: Editor) => void;

                                                                                                                                method foldAll

                                                                                                                                foldAll: (cm: Editor) => void;

                                                                                                                                  method toggleFold

                                                                                                                                  toggleFold: (cm: Editor) => void;

                                                                                                                                    method unfold

                                                                                                                                    unfold: (cm: Editor) => void;

                                                                                                                                      method unfoldAll

                                                                                                                                      unfoldAll: (cm: Editor) => void;

                                                                                                                                        interface CommandActions

                                                                                                                                        interface CommandActions {}

                                                                                                                                          property autocomplete

                                                                                                                                          autocomplete: typeof showHint;

                                                                                                                                            interface CommandActions

                                                                                                                                            interface CommandActions {}

                                                                                                                                              method goNextDiff

                                                                                                                                              goNextDiff: (cm: Editor) => void;
                                                                                                                                              • Move cursor to the next diff

                                                                                                                                              method goPrevDiff

                                                                                                                                              goPrevDiff: (cm: Editor) => void;
                                                                                                                                              • Move cursor to the previous diff

                                                                                                                                              interface CommandActions

                                                                                                                                              interface CommandActions {}

                                                                                                                                                method jumpToLine

                                                                                                                                                jumpToLine: (cm: Editor) => void;

                                                                                                                                                  interface CommandActions

                                                                                                                                                  interface CommandActions {}

                                                                                                                                                    method clearSearch

                                                                                                                                                    clearSearch: (cm: Editor) => void;

                                                                                                                                                      method find

                                                                                                                                                      find: (cm: Editor) => void;

                                                                                                                                                        method findNext

                                                                                                                                                        findNext: (cm: Editor) => void;

                                                                                                                                                          method findPersistent

                                                                                                                                                          findPersistent: (cm: Editor) => void;

                                                                                                                                                            method findPersistentNext

                                                                                                                                                            findPersistentNext: (cm: Editor) => void;

                                                                                                                                                              method findPersistentPrev

                                                                                                                                                              findPersistentPrev: (cm: Editor) => void;

                                                                                                                                                                method findPrev

                                                                                                                                                                findPrev: (cm: Editor) => void;

                                                                                                                                                                  method replace

                                                                                                                                                                  replace: (cm: Editor) => void;

                                                                                                                                                                    method replaceAll

                                                                                                                                                                    replaceAll: (cm: Editor) => void;

                                                                                                                                                                      interface CommandActions

                                                                                                                                                                      interface CommandActions {}

                                                                                                                                                                        method wrapLines

                                                                                                                                                                        wrapLines: (cm: Editor) => void;

                                                                                                                                                                          interface CommentOptions

                                                                                                                                                                          interface CommentOptions {}

                                                                                                                                                                            property blockCommentEnd

                                                                                                                                                                            blockCommentEnd?: string | undefined;
                                                                                                                                                                            • Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings.

                                                                                                                                                                            property blockCommentLead

                                                                                                                                                                            blockCommentLead?: string | undefined;
                                                                                                                                                                            • Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings.

                                                                                                                                                                            property blockCommentStart

                                                                                                                                                                            blockCommentStart?: string | undefined;
                                                                                                                                                                            • Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings.

                                                                                                                                                                            property commentBlankLines

                                                                                                                                                                            commentBlankLines?: boolean | undefined;
                                                                                                                                                                            • Whether, when adding line comments, to also comment lines that contain only whitespace.

                                                                                                                                                                            property fullLines

                                                                                                                                                                            fullLines?: boolean | undefined;
                                                                                                                                                                            • When block commenting, this controls whether the whole lines are indented, or only the precise range that is given. Defaults to true.

                                                                                                                                                                            property indent

                                                                                                                                                                            indent?: boolean | undefined;
                                                                                                                                                                            • 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.

                                                                                                                                                                            property lineComment

                                                                                                                                                                            lineComment?: string | undefined;
                                                                                                                                                                            • Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings.

                                                                                                                                                                            property padding

                                                                                                                                                                            padding?: string | null | undefined;
                                                                                                                                                                            • A string that will be inserted after opening and leading markers, and before closing comment markers. Defaults to a single space.

                                                                                                                                                                            interface CompletionEventMap

                                                                                                                                                                            interface CompletionEventMap {}

                                                                                                                                                                              property close

                                                                                                                                                                              close: () => void;

                                                                                                                                                                                property pick

                                                                                                                                                                                pick: (completion: Hint | string) => void;

                                                                                                                                                                                  property select

                                                                                                                                                                                  select: (completion: Hint | string, element: Element) => void;

                                                                                                                                                                                    property shown

                                                                                                                                                                                    shown: () => void;

                                                                                                                                                                                      interface CompletionHandle

                                                                                                                                                                                      interface CompletionHandle {}
                                                                                                                                                                                      • The Handle used to interact with the autocomplete dialog box.

                                                                                                                                                                                      property data

                                                                                                                                                                                      data: any;

                                                                                                                                                                                        property length

                                                                                                                                                                                        length: number;

                                                                                                                                                                                          method close

                                                                                                                                                                                          close: () => void;

                                                                                                                                                                                            method menuSize

                                                                                                                                                                                            menuSize: () => number;

                                                                                                                                                                                              method moveFocus

                                                                                                                                                                                              moveFocus: (n: number, avoidWrap: boolean) => void;

                                                                                                                                                                                                method pick

                                                                                                                                                                                                pick: () => void;

                                                                                                                                                                                                  method setFocus

                                                                                                                                                                                                  setFocus: (n: number) => void;

                                                                                                                                                                                                    interface Doc

                                                                                                                                                                                                    interface Doc extends DocOrEditor {}

                                                                                                                                                                                                      method copy

                                                                                                                                                                                                      copy: (copyHistory: boolean) => Doc;
                                                                                                                                                                                                      • Create an identical copy of the given doc. When copyHistory is true , the history will also be copied.

                                                                                                                                                                                                      method getEditor

                                                                                                                                                                                                      getEditor: () => Editor | null;
                                                                                                                                                                                                      • Retrieve the editor associated with a document. May return null.

                                                                                                                                                                                                      method off

                                                                                                                                                                                                      off: <T extends keyof DocEventMap>(
                                                                                                                                                                                                      eventName: T,
                                                                                                                                                                                                      handler: DocEventMap[T]
                                                                                                                                                                                                      ) => void;

                                                                                                                                                                                                        method on

                                                                                                                                                                                                        on: <T extends keyof DocEventMap>(eventName: T, handler: DocEventMap[T]) => void;

                                                                                                                                                                                                          interface DocConstructor

                                                                                                                                                                                                          interface DocConstructor {}

                                                                                                                                                                                                            construct signature

                                                                                                                                                                                                            new (
                                                                                                                                                                                                            text: string,
                                                                                                                                                                                                            mode?: string | ModeSpec<ModeSpecOptions>,
                                                                                                                                                                                                            firstLineNumber?: number,
                                                                                                                                                                                                            lineSep?: string
                                                                                                                                                                                                            ): Doc;

                                                                                                                                                                                                              call signature

                                                                                                                                                                                                              (
                                                                                                                                                                                                              text: string,
                                                                                                                                                                                                              mode?: string | ModeSpec<ModeSpecOptions>,
                                                                                                                                                                                                              firstLineNumber?: number,
                                                                                                                                                                                                              lineSep?: string
                                                                                                                                                                                                              ): Doc;

                                                                                                                                                                                                                interface DocEventMap

                                                                                                                                                                                                                interface DocEventMap {}

                                                                                                                                                                                                                  property beforeChange

                                                                                                                                                                                                                  beforeChange: (instance: Doc, changeObj: EditorChangeCancellable) => void;

                                                                                                                                                                                                                    property beforeSelectionChange

                                                                                                                                                                                                                    beforeSelectionChange: (instance: Doc, obj: EditorSelectionChange) => void;

                                                                                                                                                                                                                      property change

                                                                                                                                                                                                                      change: (instance: Doc, changeObj: EditorChange) => void;

                                                                                                                                                                                                                        property cursorActivity

                                                                                                                                                                                                                        cursorActivity: (instance: Doc) => void;

                                                                                                                                                                                                                          interface DocOrEditor

                                                                                                                                                                                                                          interface DocOrEditor {}

                                                                                                                                                                                                                            property modeOption

                                                                                                                                                                                                                            modeOption: string | ModeSpec<ModeSpecOptions>;
                                                                                                                                                                                                                            • Get the mode option

                                                                                                                                                                                                                            property state

                                                                                                                                                                                                                            state: any;
                                                                                                                                                                                                                            • Expose the state object, so that the Doc.state.completionActive property is reachable

                                                                                                                                                                                                                            method addLineWidget

                                                                                                                                                                                                                            addLineWidget: (
                                                                                                                                                                                                                            line: any,
                                                                                                                                                                                                                            node: HTMLElement,
                                                                                                                                                                                                                            options?: LineWidgetOptions
                                                                                                                                                                                                                            ) => LineWidget;
                                                                                                                                                                                                                            • 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.

                                                                                                                                                                                                                            method addSelection

                                                                                                                                                                                                                            addSelection: (anchor: Position, head?: Position) => void;
                                                                                                                                                                                                                            • Adds a new selection to the existing set of selections, and makes it the primary selection.

                                                                                                                                                                                                                            method changeGeneration

                                                                                                                                                                                                                            changeGeneration: (closeEvent?: boolean) => number;
                                                                                                                                                                                                                            • 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).

                                                                                                                                                                                                                            method clearHistory

                                                                                                                                                                                                                            clearHistory: () => void;
                                                                                                                                                                                                                            • Clears the editor's undo history.

                                                                                                                                                                                                                            method eachLine

                                                                                                                                                                                                                            eachLine: {
                                                                                                                                                                                                                            (f: (line: LineHandle) => void): void;
                                                                                                                                                                                                                            (start: number, end: number, f: (line: LineHandle) => void): void;
                                                                                                                                                                                                                            };
                                                                                                                                                                                                                            • 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).

                                                                                                                                                                                                                            • 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).

                                                                                                                                                                                                                            method extendSelection

                                                                                                                                                                                                                            extendSelection: (
                                                                                                                                                                                                                            from: Position,
                                                                                                                                                                                                                            to?: Position,
                                                                                                                                                                                                                            options?: SelectionOptions
                                                                                                                                                                                                                            ) => 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. to 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). When multiple selections are present, all but the primary selection will be dropped by this method. Supports the same options as setSelection.

                                                                                                                                                                                                                            method extendSelections

                                                                                                                                                                                                                            extendSelections: (heads: Position[], options?: SelectionOptions) => void;
                                                                                                                                                                                                                            • An equivalent of extendSelection that acts on all selections at once.

                                                                                                                                                                                                                            method extendSelectionsBy

                                                                                                                                                                                                                            extendSelectionsBy: (f: (range: Range) => Position) => void;
                                                                                                                                                                                                                            • Applies the given function to all existing selections, and calls extendSelections on the result.

                                                                                                                                                                                                                            method findMarks

                                                                                                                                                                                                                            findMarks: (from: Position, to: Position) => TextMarker[];
                                                                                                                                                                                                                            • Returns an array of all the bookmarks and marked ranges found between the given positions.

                                                                                                                                                                                                                            method findMarksAt

                                                                                                                                                                                                                            findMarksAt: (pos: Position) => TextMarker[];
                                                                                                                                                                                                                            • Returns an array of all the bookmarks and marked ranges present at the given position.

                                                                                                                                                                                                                            method firstLine

                                                                                                                                                                                                                            firstLine: () => 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.

                                                                                                                                                                                                                            method getAllMarks

                                                                                                                                                                                                                            getAllMarks: () => TextMarker[];
                                                                                                                                                                                                                            • Returns an array containing all marked ranges in the document.

                                                                                                                                                                                                                            method getCursor

                                                                                                                                                                                                                            getCursor: (start?: string) => Position;
                                                                                                                                                                                                                            • 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.

                                                                                                                                                                                                                            method getExtending

                                                                                                                                                                                                                            getExtending: () => boolean;
                                                                                                                                                                                                                            • Get the value of the 'extending' flag.

                                                                                                                                                                                                                            method getHistory

                                                                                                                                                                                                                            getHistory: () => any;
                                                                                                                                                                                                                            • Get a (JSON - serializeable) representation of the undo history.

                                                                                                                                                                                                                            method getLine

                                                                                                                                                                                                                            getLine: (n: number) => string;
                                                                                                                                                                                                                            • Get the content of line n.

                                                                                                                                                                                                                            method getLineHandle

                                                                                                                                                                                                                            getLineHandle: (num: number) => LineHandle;
                                                                                                                                                                                                                            • Fetches the line handle for the given line number.

                                                                                                                                                                                                                            method getLineNumber

                                                                                                                                                                                                                            getLineNumber: (handle: LineHandle) => number | null;
                                                                                                                                                                                                                            • Given a line handle, returns the current position of that line (or null when it is no longer in the document).

                                                                                                                                                                                                                            method getMode

                                                                                                                                                                                                                            getMode: () => Mode<unknown>;
                                                                                                                                                                                                                            • 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.

                                                                                                                                                                                                                            method getRange

                                                                                                                                                                                                                            getRange: (from: Position, to: Position, seperator?: string) => string;
                                                                                                                                                                                                                            • 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").

                                                                                                                                                                                                                            method getSelection

                                                                                                                                                                                                                            getSelection: () => string;
                                                                                                                                                                                                                            • Get the currently selected code.

                                                                                                                                                                                                                            method getSelections

                                                                                                                                                                                                                            getSelections: (lineSep?: string) => string[];
                                                                                                                                                                                                                            • Returns an array containing a string for each selection, representing the content of the selections.

                                                                                                                                                                                                                            method getValue

                                                                                                                                                                                                                            getValue: (seperator?: string) => string;
                                                                                                                                                                                                                            • 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").

                                                                                                                                                                                                                            method historySize

                                                                                                                                                                                                                            historySize: () => { undo: number; redo: number };
                                                                                                                                                                                                                            • Returns an object with {undo, redo } properties , both of which hold integers , indicating the amount of stored undo and redo operations.

                                                                                                                                                                                                                            method indexFromPos

                                                                                                                                                                                                                            indexFromPos: (object: Position) => number;
                                                                                                                                                                                                                            • The reverse of posFromIndex.

                                                                                                                                                                                                                            method isClean

                                                                                                                                                                                                                            isClean: (generation?: number) => boolean;
                                                                                                                                                                                                                            • 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.

                                                                                                                                                                                                                            method iterLinkedDocs

                                                                                                                                                                                                                            iterLinkedDocs: (fn: (doc: Doc, sharedHist: boolean) => void) => 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.

                                                                                                                                                                                                                            method lastLine

                                                                                                                                                                                                                            lastLine: () => number;
                                                                                                                                                                                                                            • Get the last line of the editor. This will usually be lineCount() - 1, but for linked sub-views, it might return other values.

                                                                                                                                                                                                                            method lineCount

                                                                                                                                                                                                                            lineCount: () => number;
                                                                                                                                                                                                                            • Get the number of lines in the editor.

                                                                                                                                                                                                                            method lineSeparator

                                                                                                                                                                                                                            lineSeparator: () => string;
                                                                                                                                                                                                                            • 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.

                                                                                                                                                                                                                            method linkedDoc

                                                                                                                                                                                                                            linkedDoc: (options: {
                                                                                                                                                                                                                            sharedHist?: boolean | undefined;
                                                                                                                                                                                                                            from?: number | undefined;
                                                                                                                                                                                                                            to?: number | undefined;
                                                                                                                                                                                                                            mode?: string | ModeSpec<ModeSpecOptions> | undefined;
                                                                                                                                                                                                                            }) => 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.

                                                                                                                                                                                                                            method listSelections

                                                                                                                                                                                                                            listSelections: () => Range[];
                                                                                                                                                                                                                            • 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.

                                                                                                                                                                                                                            method markClean

                                                                                                                                                                                                                            markClean: () => 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.

                                                                                                                                                                                                                            method markText

                                                                                                                                                                                                                            markText: (
                                                                                                                                                                                                                            from: Position,
                                                                                                                                                                                                                            to: Position,
                                                                                                                                                                                                                            options?: TextMarkerOptions
                                                                                                                                                                                                                            ) => TextMarker<MarkerRange>;
                                                                                                                                                                                                                            • Can be used to mark a range of text with a specific CSS class name. from and to should be { line , ch } objects.

                                                                                                                                                                                                                            method posFromIndex

                                                                                                                                                                                                                            posFromIndex: (index: number) => Position;
                                                                                                                                                                                                                            • 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.

                                                                                                                                                                                                                            method redo

                                                                                                                                                                                                                            redo: () => void;
                                                                                                                                                                                                                            • Redo one undone edit.

                                                                                                                                                                                                                            method redoSelection

                                                                                                                                                                                                                            redoSelection: () => void;
                                                                                                                                                                                                                            • Redo one undone edit or selection change.

                                                                                                                                                                                                                            method removeLine

                                                                                                                                                                                                                            removeLine: (n: number) => void;
                                                                                                                                                                                                                            • Remove the given line from the document.

                                                                                                                                                                                                                            method removeLineWidget

                                                                                                                                                                                                                            removeLineWidget: (widget: LineWidget) => void;
                                                                                                                                                                                                                            • Remove the line widget

                                                                                                                                                                                                                            method replaceRange

                                                                                                                                                                                                                            replaceRange: (
                                                                                                                                                                                                                            replacement: string | string[],
                                                                                                                                                                                                                            from: Position,
                                                                                                                                                                                                                            to?: Position,
                                                                                                                                                                                                                            origin?: string
                                                                                                                                                                                                                            ) => void;
                                                                                                                                                                                                                            • 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.

                                                                                                                                                                                                                            method replaceSelection

                                                                                                                                                                                                                            replaceSelection: (replacement: string, collapse?: string) => void;
                                                                                                                                                                                                                            • 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.

                                                                                                                                                                                                                            method replaceSelections

                                                                                                                                                                                                                            replaceSelections: (replacements: string[], collapse?: string) => void;
                                                                                                                                                                                                                            • Replaces the content of the selections with the strings in the array. The length of the given array should be the same as the number of active selections. The collapse argument works the same as in replaceSelection.

                                                                                                                                                                                                                            method setBookmark

                                                                                                                                                                                                                            setBookmark: (
                                                                                                                                                                                                                            pos: Position,
                                                                                                                                                                                                                            options?: {
                                                                                                                                                                                                                            widget?: HTMLElement | undefined;
                                                                                                                                                                                                                            insertLeft?: boolean | undefined;
                                                                                                                                                                                                                            shared?: boolean | undefined;
                                                                                                                                                                                                                            handleMouseEvents?: boolean | undefined;
                                                                                                                                                                                                                            }
                                                                                                                                                                                                                            ) => TextMarker<Position>;
                                                                                                                                                                                                                            • 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.

                                                                                                                                                                                                                            method setCursor

                                                                                                                                                                                                                            setCursor: (
                                                                                                                                                                                                                            pos: Position | number,
                                                                                                                                                                                                                            ch?: number,
                                                                                                                                                                                                                            options?: {
                                                                                                                                                                                                                            bias?: number | undefined;
                                                                                                                                                                                                                            origin?: string | undefined;
                                                                                                                                                                                                                            scroll?: boolean | undefined;
                                                                                                                                                                                                                            }
                                                                                                                                                                                                                            ) => void;
                                                                                                                                                                                                                            • 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

                                                                                                                                                                                                                            method setExtending

                                                                                                                                                                                                                            setExtending: (value: boolean) => 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.

                                                                                                                                                                                                                            method setHistory

                                                                                                                                                                                                                            setHistory: (history: any) => void;
                                                                                                                                                                                                                            • 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.

                                                                                                                                                                                                                            method setLine

                                                                                                                                                                                                                            setLine: (n: number, text: string) => void;
                                                                                                                                                                                                                            • Set the content of line n.

                                                                                                                                                                                                                            method setSelection

                                                                                                                                                                                                                            setSelection: (
                                                                                                                                                                                                                            anchor: Position,
                                                                                                                                                                                                                            head?: Position,
                                                                                                                                                                                                                            options?: {
                                                                                                                                                                                                                            bias?: number | undefined;
                                                                                                                                                                                                                            origin?: string | undefined;
                                                                                                                                                                                                                            scroll?: boolean | undefined;
                                                                                                                                                                                                                            }
                                                                                                                                                                                                                            ) => void;
                                                                                                                                                                                                                            • Set a single selection range. anchor and head should be {line, ch} objects. head defaults to anchor when not given.

                                                                                                                                                                                                                            method setSelections

                                                                                                                                                                                                                            setSelections: (
                                                                                                                                                                                                                            ranges: Array<{ anchor: Position; head: Position }>,
                                                                                                                                                                                                                            primary?: number,
                                                                                                                                                                                                                            options?: SelectionOptions
                                                                                                                                                                                                                            ) => 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.

                                                                                                                                                                                                                            method setValue

                                                                                                                                                                                                                            setValue: (content: string) => void;
                                                                                                                                                                                                                            • Set the editor content.

                                                                                                                                                                                                                            method somethingSelected

                                                                                                                                                                                                                            somethingSelected: () => boolean;
                                                                                                                                                                                                                            • Return true if any text is selected.

                                                                                                                                                                                                                            method undo

                                                                                                                                                                                                                            undo: () => void;
                                                                                                                                                                                                                            • Undo one edit (if any undo events are stored).

                                                                                                                                                                                                                            method undoSelection

                                                                                                                                                                                                                            undoSelection: () => void;
                                                                                                                                                                                                                            • Undo one edit or selection change.

                                                                                                                                                                                                                            method unlinkDoc

                                                                                                                                                                                                                            unlinkDoc: (doc: Doc) => void;
                                                                                                                                                                                                                            • 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.

                                                                                                                                                                                                                            interface DocOrEditor

                                                                                                                                                                                                                            interface DocOrEditor {}

                                                                                                                                                                                                                              method getSearchCursor

                                                                                                                                                                                                                              getSearchCursor: (
                                                                                                                                                                                                                              query: string | RegExp,
                                                                                                                                                                                                                              start?: Position,
                                                                                                                                                                                                                              caseFold?: boolean
                                                                                                                                                                                                                              ) => SearchCursor;
                                                                                                                                                                                                                              • 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

                                                                                                                                                                                                                              interface Editor

                                                                                                                                                                                                                              interface Editor extends DocOrEditor {}
                                                                                                                                                                                                                              • Methods prefixed with doc. can, unless otherwise specified, be called both on CodeMirror (editor) instances and CodeMirror.Doc instances. Thus, the Editor interface extends DocOrEditor defining the common API.

                                                                                                                                                                                                                              property state

                                                                                                                                                                                                                              state: any;
                                                                                                                                                                                                                              • Expose the state object, so that the Editor.state.completionActive property is reachable

                                                                                                                                                                                                                              method addKeyMap

                                                                                                                                                                                                                              addKeyMap: (map: string | KeyMap, bottom?: boolean) => void;
                                                                                                                                                                                                                              • 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.

                                                                                                                                                                                                                              method addLineClass

                                                                                                                                                                                                                              addLineClass: (line: any, where: string, _class_: string) => LineHandle;
                                                                                                                                                                                                                              • 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.

                                                                                                                                                                                                                              method addLineWidget

                                                                                                                                                                                                                              addLineWidget: (
                                                                                                                                                                                                                              line: any,
                                                                                                                                                                                                                              node: HTMLElement,
                                                                                                                                                                                                                              options?: LineWidgetOptions
                                                                                                                                                                                                                              ) => LineWidget;
                                                                                                                                                                                                                              • 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.

                                                                                                                                                                                                                              method addOverlay

                                                                                                                                                                                                                              addOverlay: (
                                                                                                                                                                                                                              mode: any,
                                                                                                                                                                                                                              options?: { opaque?: boolean | undefined; priority?: number | undefined }
                                                                                                                                                                                                                              ) => 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.

                                                                                                                                                                                                                              method addWidget

                                                                                                                                                                                                                              addWidget: (pos: Position, node: HTMLElement, scrollIntoView: boolean) => void;
                                                                                                                                                                                                                              • 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).

                                                                                                                                                                                                                              method charCoords

                                                                                                                                                                                                                              charCoords: (
                                                                                                                                                                                                                              pos: Position,
                                                                                                                                                                                                                              mode?: CoordsMode
                                                                                                                                                                                                                              ) => { left: number; right: 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.

                                                                                                                                                                                                                              method clearGutter

                                                                                                                                                                                                                              clearGutter: (gutterID: string) => void;
                                                                                                                                                                                                                              • Remove all gutter markers in the gutter with the given ID.

                                                                                                                                                                                                                              method coordsChar

                                                                                                                                                                                                                              coordsChar: (
                                                                                                                                                                                                                              object: { left: number; top: number },
                                                                                                                                                                                                                              mode?: CoordsMode
                                                                                                                                                                                                                              ) => Position;
                                                                                                                                                                                                                              • 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".

                                                                                                                                                                                                                              method cursorCoords

                                                                                                                                                                                                                              cursorCoords: (
                                                                                                                                                                                                                              where?: boolean | Position | null,
                                                                                                                                                                                                                              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 position at which you want to measure. A boolean indicates either the start(true) or the end(false) of the selection.

                                                                                                                                                                                                                              method defaultCharWidth

                                                                                                                                                                                                                              defaultCharWidth: () => 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).

                                                                                                                                                                                                                              method defaultTextHeight

                                                                                                                                                                                                                              defaultTextHeight: () => number;
                                                                                                                                                                                                                              • Returns the line height of the default font for the editor.

                                                                                                                                                                                                                              method endOperation

                                                                                                                                                                                                                              endOperation: () => void;

                                                                                                                                                                                                                                method execCommand

                                                                                                                                                                                                                                execCommand: (name: string) => void;
                                                                                                                                                                                                                                • Runs the command with the given name on the editor.

                                                                                                                                                                                                                                method findPosH

                                                                                                                                                                                                                                findPosH: (
                                                                                                                                                                                                                                start: Position,
                                                                                                                                                                                                                                amount: number,
                                                                                                                                                                                                                                unit: string,
                                                                                                                                                                                                                                visually: boolean
                                                                                                                                                                                                                                ) => { line: number; ch: number; hitSide?: boolean | undefined };
                                                                                                                                                                                                                                • Used to find the target position for horizontal cursor motion.start is a { line , ch } object, 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.

                                                                                                                                                                                                                                method findPosV

                                                                                                                                                                                                                                findPosV: (
                                                                                                                                                                                                                                start: Position,
                                                                                                                                                                                                                                amount: number,
                                                                                                                                                                                                                                unit: string
                                                                                                                                                                                                                                ) => { line: number; ch: number; hitSide?: boolean | undefined };
                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                method findWordAt

                                                                                                                                                                                                                                findWordAt: (pos: Position) => Range;
                                                                                                                                                                                                                                • Returns the start and end of the 'word' (the stretch of letters, whitespace, or punctuation) at the given position.

                                                                                                                                                                                                                                method focus

                                                                                                                                                                                                                                focus: () => void;
                                                                                                                                                                                                                                • Give the editor focus.

                                                                                                                                                                                                                                method getCursor

                                                                                                                                                                                                                                getCursor: (start?: string) => Position;
                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                method getDoc

                                                                                                                                                                                                                                getDoc: () => Doc;
                                                                                                                                                                                                                                • Retrieve the currently active document from an editor.

                                                                                                                                                                                                                                method getGutterElement

                                                                                                                                                                                                                                getGutterElement: () => HTMLElement;
                                                                                                                                                                                                                                • Fetches the DOM node that contains the editor gutters.

                                                                                                                                                                                                                                method getInputField

                                                                                                                                                                                                                                getInputField: () => HTMLTextAreaElement;
                                                                                                                                                                                                                                • Returns the hidden textarea used to read input.

                                                                                                                                                                                                                                method getLineTokens

                                                                                                                                                                                                                                getLineTokens: (line: number, precise?: boolean) => Token[];
                                                                                                                                                                                                                                • This is similar to getTokenAt, but collects all tokens for a given line into an array.

                                                                                                                                                                                                                                method getModeAt

                                                                                                                                                                                                                                getModeAt: (pos: Position) => Mode<unknown>;
                                                                                                                                                                                                                                • 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).

                                                                                                                                                                                                                                method getOption

                                                                                                                                                                                                                                getOption: <K extends keyof EditorConfiguration>(
                                                                                                                                                                                                                                option: K
                                                                                                                                                                                                                                ) => EditorConfiguration[K];
                                                                                                                                                                                                                                • Retrieves the current value of the given option for this editor instance.

                                                                                                                                                                                                                                method getScrollerElement

                                                                                                                                                                                                                                getScrollerElement: () => HTMLElement;
                                                                                                                                                                                                                                • Returns the DOM node that is responsible for the scrolling of the editor.

                                                                                                                                                                                                                                method getScrollInfo

                                                                                                                                                                                                                                getScrollInfo: () => ScrollInfo;
                                                                                                                                                                                                                                • 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).

                                                                                                                                                                                                                                method getStateAfter

                                                                                                                                                                                                                                getStateAfter: (line?: number) => any;
                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                method getTokenAt

                                                                                                                                                                                                                                getTokenAt: (pos: Position, precise?: boolean) => Token;
                                                                                                                                                                                                                                • Retrieves information about the token the current mode found before the given position (a {line, ch} object).

                                                                                                                                                                                                                                method getTokenTypeAt

                                                                                                                                                                                                                                getTokenTypeAt: (pos: Position) => string;
                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                method getValue

                                                                                                                                                                                                                                getValue: (seperator?: string) => string;
                                                                                                                                                                                                                                • 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").

                                                                                                                                                                                                                                method getViewport

                                                                                                                                                                                                                                getViewport: () => { from: number; to: 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.

                                                                                                                                                                                                                                method getWrapperElement

                                                                                                                                                                                                                                getWrapperElement: () => HTMLElement;
                                                                                                                                                                                                                                • Returns the DOM node that represents the editor, and controls its size. Remove this from your tree to delete an editor instance.

                                                                                                                                                                                                                                method hasFocus

                                                                                                                                                                                                                                hasFocus: () => boolean;
                                                                                                                                                                                                                                • Tells you whether the editor currently has focus.

                                                                                                                                                                                                                                method heightAtLine

                                                                                                                                                                                                                                heightAtLine: (line: any, mode?: CoordsMode, includeWidgets?: boolean) => 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.

                                                                                                                                                                                                                                method indentLine

                                                                                                                                                                                                                                indentLine: (line: number, dir?: string) => 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.

                                                                                                                                                                                                                                method indentSelection

                                                                                                                                                                                                                                indentSelection: (how: string) => void;
                                                                                                                                                                                                                                • Indent a selection

                                                                                                                                                                                                                                method isReadOnly

                                                                                                                                                                                                                                isReadOnly: () => boolean;
                                                                                                                                                                                                                                • Tells you whether the editor's content can be edited by the user.

                                                                                                                                                                                                                                method lineAtHeight

                                                                                                                                                                                                                                lineAtHeight: (height: number, mode?: CoordsMode) => number;
                                                                                                                                                                                                                                • 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"

                                                                                                                                                                                                                                method lineInfo

                                                                                                                                                                                                                                lineInfo: (line: any) => {
                                                                                                                                                                                                                                line: any;
                                                                                                                                                                                                                                handle: any;
                                                                                                                                                                                                                                text: string;
                                                                                                                                                                                                                                gutterMarkers: any;
                                                                                                                                                                                                                                textClass: string;
                                                                                                                                                                                                                                bgClass: string;
                                                                                                                                                                                                                                wrapClass: string;
                                                                                                                                                                                                                                widgets: any;
                                                                                                                                                                                                                                };
                                                                                                                                                                                                                                • Returns the line number, text content, and marker status of the given line, which can be either a number or a line handle.

                                                                                                                                                                                                                                method off

                                                                                                                                                                                                                                off: {
                                                                                                                                                                                                                                <T extends keyof EditorEventMap>(
                                                                                                                                                                                                                                eventName: T,
                                                                                                                                                                                                                                handler: EditorEventMap[T]
                                                                                                                                                                                                                                ): void;
                                                                                                                                                                                                                                <
                                                                                                                                                                                                                                K extends
                                                                                                                                                                                                                                | 'mousedown'
                                                                                                                                                                                                                                | 'dblclick'
                                                                                                                                                                                                                                | 'touchstart'
                                                                                                                                                                                                                                | 'contextmenu'
                                                                                                                                                                                                                                | 'keydown'
                                                                                                                                                                                                                                | 'keypress'
                                                                                                                                                                                                                                | 'keyup'
                                                                                                                                                                                                                                | 'dragstart'
                                                                                                                                                                                                                                | 'dragenter'
                                                                                                                                                                                                                                | 'dragover'
                                                                                                                                                                                                                                | 'dragleave'
                                                                                                                                                                                                                                | 'drop'
                                                                                                                                                                                                                                >(
                                                                                                                                                                                                                                eventName: K,
                                                                                                                                                                                                                                handler: (
                                                                                                                                                                                                                                instance: Editor,
                                                                                                                                                                                                                                event: GlobalEventHandlersEventMap[K]
                                                                                                                                                                                                                                ) => void
                                                                                                                                                                                                                                ): void;
                                                                                                                                                                                                                                };

                                                                                                                                                                                                                                  method on

                                                                                                                                                                                                                                  on: {
                                                                                                                                                                                                                                  <T extends keyof EditorEventMap>(
                                                                                                                                                                                                                                  eventName: T,
                                                                                                                                                                                                                                  handler: EditorEventMap[T]
                                                                                                                                                                                                                                  ): void;
                                                                                                                                                                                                                                  <
                                                                                                                                                                                                                                  K extends
                                                                                                                                                                                                                                  | 'mousedown'
                                                                                                                                                                                                                                  | 'dblclick'
                                                                                                                                                                                                                                  | 'touchstart'
                                                                                                                                                                                                                                  | 'contextmenu'
                                                                                                                                                                                                                                  | 'keydown'
                                                                                                                                                                                                                                  | 'keypress'
                                                                                                                                                                                                                                  | 'keyup'
                                                                                                                                                                                                                                  | 'dragstart'
                                                                                                                                                                                                                                  | 'dragenter'
                                                                                                                                                                                                                                  | 'dragover'
                                                                                                                                                                                                                                  | 'dragleave'
                                                                                                                                                                                                                                  | 'drop'
                                                                                                                                                                                                                                  >(
                                                                                                                                                                                                                                  eventName: K,
                                                                                                                                                                                                                                  handler: (
                                                                                                                                                                                                                                  instance: Editor,
                                                                                                                                                                                                                                  event: GlobalEventHandlersEventMap[K]
                                                                                                                                                                                                                                  ) => void
                                                                                                                                                                                                                                  ): void;
                                                                                                                                                                                                                                  };

                                                                                                                                                                                                                                    method operation

                                                                                                                                                                                                                                    operation: <T>(fn: () => T) => T;
                                                                                                                                                                                                                                    • 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.

                                                                                                                                                                                                                                    method phrase

                                                                                                                                                                                                                                    phrase: (text: string) => unknown;
                                                                                                                                                                                                                                    • Allow the given string to be translated with the phrases option.

                                                                                                                                                                                                                                    method refresh

                                                                                                                                                                                                                                    refresh: () => void;
                                                                                                                                                                                                                                    • 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.

                                                                                                                                                                                                                                    method removeKeyMap

                                                                                                                                                                                                                                    removeKeyMap: (map: string | KeyMap) => 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.

                                                                                                                                                                                                                                    method removeLineClass

                                                                                                                                                                                                                                    removeLineClass: (line: any, where: string, class_?: string) => 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.

                                                                                                                                                                                                                                    method removeOverlay

                                                                                                                                                                                                                                    removeOverlay: (mode: any) => void;
                                                                                                                                                                                                                                    • Pass this the exact argument passed for the mode parameter to addOverlay to remove an overlay again.

                                                                                                                                                                                                                                    method scrollIntoView

                                                                                                                                                                                                                                    scrollIntoView: (
                                                                                                                                                                                                                                    pos:
                                                                                                                                                                                                                                    | Position
                                                                                                                                                                                                                                    | null
                                                                                                                                                                                                                                    | { line: number; ch: number }
                                                                                                                                                                                                                                    | { left: number; top: number; right: number; bottom: number }
                                                                                                                                                                                                                                    | { from: Position; to: Position },
                                                                                                                                                                                                                                    margin?: number
                                                                                                                                                                                                                                    ) => void;
                                                                                                                                                                                                                                    • Scrolls the given element into view. pos can be: - a { line , ch } position, referring to a given character - null, to refer to the cursor - a { left , top , right , bottom } object, in editor-local coordinates - 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.

                                                                                                                                                                                                                                    method scrollTo

                                                                                                                                                                                                                                    scrollTo: (x?: number | null, y?: number | null) => void;
                                                                                                                                                                                                                                    • Scroll the editor to a given(pixel) position.Both arguments may be left as null or undefined to have no effect.

                                                                                                                                                                                                                                    method setCursor

                                                                                                                                                                                                                                    setCursor: (
                                                                                                                                                                                                                                    pos: Position | number,
                                                                                                                                                                                                                                    ch?: number,
                                                                                                                                                                                                                                    options?: {
                                                                                                                                                                                                                                    bias?: number | undefined;
                                                                                                                                                                                                                                    origin?: string | undefined;
                                                                                                                                                                                                                                    scroll?: boolean | undefined;
                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                    ) => void;
                                                                                                                                                                                                                                    • 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

                                                                                                                                                                                                                                    method setGutterMarker

                                                                                                                                                                                                                                    setGutterMarker: (
                                                                                                                                                                                                                                    line: any,
                                                                                                                                                                                                                                    gutterID: string,
                                                                                                                                                                                                                                    value: HTMLElement | null
                                                                                                                                                                                                                                    ) => LineHandle;
                                                                                                                                                                                                                                    • 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.

                                                                                                                                                                                                                                    method setOption

                                                                                                                                                                                                                                    setOption: <K extends keyof EditorConfiguration>(
                                                                                                                                                                                                                                    option: K,
                                                                                                                                                                                                                                    value: EditorConfiguration[K]
                                                                                                                                                                                                                                    ) => void;
                                                                                                                                                                                                                                    • Change the configuration of the editor. option should the name of an option, and value should be a valid value for that option.

                                                                                                                                                                                                                                    method setSize

                                                                                                                                                                                                                                    setSize: (width: any, height: any) => void;
                                                                                                                                                                                                                                    • 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.

                                                                                                                                                                                                                                    method setValue

                                                                                                                                                                                                                                    setValue: (content: string) => void;
                                                                                                                                                                                                                                    • Set the content of the current editor document.

                                                                                                                                                                                                                                    method startOperation

                                                                                                                                                                                                                                    startOperation: () => void;
                                                                                                                                                                                                                                    • 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.

                                                                                                                                                                                                                                    method swapDoc

                                                                                                                                                                                                                                    swapDoc: (doc: Doc) => Doc;
                                                                                                                                                                                                                                    • Attach a new document to the editor. Returns the old document, which is now no longer associated with an editor.

                                                                                                                                                                                                                                    method toggleOverwrite

                                                                                                                                                                                                                                    toggleOverwrite: (value?: boolean) => void;
                                                                                                                                                                                                                                    • 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).

                                                                                                                                                                                                                                    interface Editor

                                                                                                                                                                                                                                    interface Editor {}

                                                                                                                                                                                                                                      method blockComment

                                                                                                                                                                                                                                      blockComment: (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.

                                                                                                                                                                                                                                      method lineComment

                                                                                                                                                                                                                                      lineComment: (from: Position, to: Position, 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.

                                                                                                                                                                                                                                      method toggleComment

                                                                                                                                                                                                                                      toggleComment: (options?: CommentOptions) => void;
                                                                                                                                                                                                                                      • Tries to uncomment the current selection, and if that fails, line-comments it.

                                                                                                                                                                                                                                      method uncomment

                                                                                                                                                                                                                                      uncomment: (from: Position, to: Position, options?: CommentOptions) => boolean;
                                                                                                                                                                                                                                      • Try to uncomment the given range. Returns true if a comment range was found and removed, false otherwise.

                                                                                                                                                                                                                                      interface Editor

                                                                                                                                                                                                                                      interface Editor {}

                                                                                                                                                                                                                                        method openConfirm

                                                                                                                                                                                                                                        openConfirm: (
                                                                                                                                                                                                                                        template: string | Node,
                                                                                                                                                                                                                                        callbacks: readonly ((editor: Editor) => void)[],
                                                                                                                                                                                                                                        options?: DialogOptions
                                                                                                                                                                                                                                        ) => DialogCloseFunction;

                                                                                                                                                                                                                                          method openDialog

                                                                                                                                                                                                                                          openDialog: (
                                                                                                                                                                                                                                          template: string | Node,
                                                                                                                                                                                                                                          callback: (value: string, e: Event) => void,
                                                                                                                                                                                                                                          options?: OpenDialogOptions
                                                                                                                                                                                                                                          ) => DialogCloseFunction;
                                                                                                                                                                                                                                          • Provides a very simple way to query users for text input.

                                                                                                                                                                                                                                          method openNotification

                                                                                                                                                                                                                                          openNotification: (
                                                                                                                                                                                                                                          template: string | Node,
                                                                                                                                                                                                                                          options?: OpenNotificationOptions
                                                                                                                                                                                                                                          ) => DialogCloseFunction;

                                                                                                                                                                                                                                            interface Editor

                                                                                                                                                                                                                                            interface Editor {}

                                                                                                                                                                                                                                              method addPanel

                                                                                                                                                                                                                                              addPanel: (node: HTMLElement, options?: ShowPanelOptions) => Panel;
                                                                                                                                                                                                                                              • 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.

                                                                                                                                                                                                                                                Parameter node

                                                                                                                                                                                                                                                the DOM node

                                                                                                                                                                                                                                                Parameter options

                                                                                                                                                                                                                                                optional options object

                                                                                                                                                                                                                                              interface Editor

                                                                                                                                                                                                                                              interface Editor {}

                                                                                                                                                                                                                                                property foldCode

                                                                                                                                                                                                                                                foldCode: (
                                                                                                                                                                                                                                                lineOrPos: number | Position,
                                                                                                                                                                                                                                                rangeFindeOrFoldOptions?: FoldRangeFinder | FoldOptions,
                                                                                                                                                                                                                                                force?: 'fold' | 'unfold'
                                                                                                                                                                                                                                                ) => void;
                                                                                                                                                                                                                                                • Helps with code folding. Adds a foldCode method to editor instances, which will try to do a code fold starting at the given line, or unfold the fold that is already present. The method takes as first argument the position that should be folded (may be a line number or a Pos), and as second optional argument either a range-finder function, or an options object.

                                                                                                                                                                                                                                                method foldOption

                                                                                                                                                                                                                                                foldOption: <K extends keyof FoldOptions>(option: K) => FoldOptions[K];

                                                                                                                                                                                                                                                  method isFolded

                                                                                                                                                                                                                                                  isFolded: (pos: Position) => boolean | undefined;

                                                                                                                                                                                                                                                    interface Editor

                                                                                                                                                                                                                                                    interface Editor {}

                                                                                                                                                                                                                                                      method closeHint

                                                                                                                                                                                                                                                      closeHint: () => void;

                                                                                                                                                                                                                                                        method showHint

                                                                                                                                                                                                                                                        showHint: (options?: ShowHintOptions) => void;

                                                                                                                                                                                                                                                          interface Editor

                                                                                                                                                                                                                                                          interface Editor {}

                                                                                                                                                                                                                                                            property performLint

                                                                                                                                                                                                                                                            performLint: () => void;

                                                                                                                                                                                                                                                              interface Editor

                                                                                                                                                                                                                                                              interface Editor {}

                                                                                                                                                                                                                                                                method annotateScrollbar

                                                                                                                                                                                                                                                                annotateScrollbar: (options: string | AnnotateScrollbarOptions) => Annotation;

                                                                                                                                                                                                                                                                  interface Editor

                                                                                                                                                                                                                                                                  interface Editor {}

                                                                                                                                                                                                                                                                    method showMatchesOnScrollbar

                                                                                                                                                                                                                                                                    showMatchesOnScrollbar: (
                                                                                                                                                                                                                                                                    query: string | RegExp,
                                                                                                                                                                                                                                                                    caseFold?: boolean,
                                                                                                                                                                                                                                                                    className?: string
                                                                                                                                                                                                                                                                    ) => SearchAnnotation;

                                                                                                                                                                                                                                                                      interface Editor

                                                                                                                                                                                                                                                                      interface Editor {}

                                                                                                                                                                                                                                                                        method wrapParagraph

                                                                                                                                                                                                                                                                        wrapParagraph: (pos?: Position, options?: HardwrapOptions) => void;
                                                                                                                                                                                                                                                                        • Wraps the paragraph at the given position. If pos is not given, it defaults to the cursor position.

                                                                                                                                                                                                                                                                        method wrapParagraphsInRange

                                                                                                                                                                                                                                                                        wrapParagraphsInRange: (
                                                                                                                                                                                                                                                                        from: Position,
                                                                                                                                                                                                                                                                        to: Position,
                                                                                                                                                                                                                                                                        options?: HardwrapOptions
                                                                                                                                                                                                                                                                        ) => void;
                                                                                                                                                                                                                                                                        • Wraps the paragraphs in (and overlapping with) the given range individually.

                                                                                                                                                                                                                                                                        method wrapRange

                                                                                                                                                                                                                                                                        wrapRange: (from: Position, to: Position, options?: HardwrapOptions) => void;
                                                                                                                                                                                                                                                                        • Wraps the given range as one big paragraph.

                                                                                                                                                                                                                                                                        interface EditorChange

                                                                                                                                                                                                                                                                        interface EditorChange {}

                                                                                                                                                                                                                                                                          property from

                                                                                                                                                                                                                                                                          from: Position;
                                                                                                                                                                                                                                                                          • Position (in the pre-change coordinate system) where the change started.

                                                                                                                                                                                                                                                                          property origin

                                                                                                                                                                                                                                                                          origin?: string | undefined;
                                                                                                                                                                                                                                                                          • String representing the origin of the change event and whether it can be merged with history

                                                                                                                                                                                                                                                                          property removed

                                                                                                                                                                                                                                                                          removed?: string[] | undefined;
                                                                                                                                                                                                                                                                          • Text that used to be between from and to, which is overwritten by this change.

                                                                                                                                                                                                                                                                          property text

                                                                                                                                                                                                                                                                          text: string[];
                                                                                                                                                                                                                                                                          • Array of strings representing the text that replaced the changed range (split by line).

                                                                                                                                                                                                                                                                          property to

                                                                                                                                                                                                                                                                          to: Position;
                                                                                                                                                                                                                                                                          • Position (in the pre-change coordinate system) where the change ended.

                                                                                                                                                                                                                                                                          interface EditorChangeCancellable

                                                                                                                                                                                                                                                                          interface EditorChangeCancellable extends EditorChange {}

                                                                                                                                                                                                                                                                            method cancel

                                                                                                                                                                                                                                                                            cancel: () => void;

                                                                                                                                                                                                                                                                              method update

                                                                                                                                                                                                                                                                              update: (from?: Position, to?: Position, text?: string[]) => void;
                                                                                                                                                                                                                                                                              • 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.

                                                                                                                                                                                                                                                                              interface EditorConfiguration

                                                                                                                                                                                                                                                                              interface EditorConfiguration {}

                                                                                                                                                                                                                                                                                property addModeClass

                                                                                                                                                                                                                                                                                addModeClass?: boolean | undefined;
                                                                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                                                                property allowDropFileTypes

                                                                                                                                                                                                                                                                                allowDropFileTypes?: string[] | null | undefined;
                                                                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                                                                property autocapitalize

                                                                                                                                                                                                                                                                                autocapitalize?: boolean | undefined;
                                                                                                                                                                                                                                                                                • Specifies whether or not autocapitalization will be enabled on the input.

                                                                                                                                                                                                                                                                                property autocorrect

                                                                                                                                                                                                                                                                                autocorrect?: boolean | undefined;
                                                                                                                                                                                                                                                                                • Specifies whether or not autocorrect will be enabled on the input.

                                                                                                                                                                                                                                                                                property autofocus

                                                                                                                                                                                                                                                                                autofocus?: boolean | undefined;
                                                                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                                                                property configureMouse

                                                                                                                                                                                                                                                                                configureMouse?:
                                                                                                                                                                                                                                                                                | ((
                                                                                                                                                                                                                                                                                cm: Editor,
                                                                                                                                                                                                                                                                                repeat: 'single' | 'double' | 'triple',
                                                                                                                                                                                                                                                                                event: Event
                                                                                                                                                                                                                                                                                ) => MouseSelectionConfiguration)
                                                                                                                                                                                                                                                                                | undefined;
                                                                                                                                                                                                                                                                                • Allows you to configure the behavior of mouse selection and dragging. The function is called when the left mouse button is pressed.

                                                                                                                                                                                                                                                                                property coverGutterNextToScrollbar

                                                                                                                                                                                                                                                                                coverGutterNextToScrollbar?: boolean | undefined;
                                                                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                                                                property cursorBlinkRate

                                                                                                                                                                                                                                                                                cursorBlinkRate?: number | undefined;
                                                                                                                                                                                                                                                                                • Half - period in milliseconds used for cursor blinking. The default blink rate is 530ms.

                                                                                                                                                                                                                                                                                property cursorHeight

                                                                                                                                                                                                                                                                                cursorHeight?: number | undefined;
                                                                                                                                                                                                                                                                                • 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

                                                                                                                                                                                                                                                                                property cursorScrollMargin

                                                                                                                                                                                                                                                                                cursorScrollMargin?: number | undefined;
                                                                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                                                                property direction

                                                                                                                                                                                                                                                                                direction?: 'ltr' | 'rtl' | undefined;
                                                                                                                                                                                                                                                                                • Flips overall layout and selects base paragraph direction to be left-to-right or right-to-left. Default is "ltr". CodeMirror applies the Unicode Bidirectional Algorithm to each line, but does not autodetect base direction — it's set to the editor direction for all lines. The resulting order is sometimes wrong when base direction doesn't match user intent (for example, leading and trailing punctuation jumps to the wrong side of the line). Therefore, it's helpful for multilingual input to let users toggle this option.

                                                                                                                                                                                                                                                                                property dragDrop

                                                                                                                                                                                                                                                                                dragDrop?: boolean | undefined;
                                                                                                                                                                                                                                                                                • Controls whether drag-and - drop is enabled. On by default.

                                                                                                                                                                                                                                                                                property electricChars

                                                                                                                                                                                                                                                                                electricChars?: boolean | undefined;
                                                                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                                                                property extraKeys

                                                                                                                                                                                                                                                                                extraKeys?: string | KeyMap | undefined;
                                                                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                                                                property firstLineNumber

                                                                                                                                                                                                                                                                                firstLineNumber?: number | undefined;
                                                                                                                                                                                                                                                                                • At which number to start counting lines. Default is 1.

                                                                                                                                                                                                                                                                                property fixedGutter

                                                                                                                                                                                                                                                                                fixedGutter?: boolean | undefined;
                                                                                                                                                                                                                                                                                • Determines whether the gutter scrolls along with the content horizontally (false) or whether it stays fixed during horizontal scrolling (true, the default).

                                                                                                                                                                                                                                                                                property flattenSpans

                                                                                                                                                                                                                                                                                flattenSpans?: boolean | undefined;
                                                                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                                                                property gutters

                                                                                                                                                                                                                                                                                gutters?:
                                                                                                                                                                                                                                                                                | Array<string | { className: string; style?: string | undefined }>
                                                                                                                                                                                                                                                                                | undefined;
                                                                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                                                                property historyEventDelay

                                                                                                                                                                                                                                                                                historyEventDelay?: number | undefined;
                                                                                                                                                                                                                                                                                • The period of inactivity (in milliseconds) that will cause a new history event to be started when typing or deleting. Defaults to 500.

                                                                                                                                                                                                                                                                                property indentUnit

                                                                                                                                                                                                                                                                                indentUnit?: number | undefined;
                                                                                                                                                                                                                                                                                • How many spaces a block (whatever that means in the edited language) should be indented. The default is 2.

                                                                                                                                                                                                                                                                                property indentWithTabs

                                                                                                                                                                                                                                                                                indentWithTabs?: boolean | undefined;
                                                                                                                                                                                                                                                                                • Whether, when indenting, the first N*tabSize spaces should be replaced by N tabs. Default is false.

                                                                                                                                                                                                                                                                                property inputStyle

                                                                                                                                                                                                                                                                                inputStyle?: InputStyle | undefined;
                                                                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                                                                property keyMap

                                                                                                                                                                                                                                                                                keyMap?: string | undefined;
                                                                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                                                                property lineNumberFormatter

                                                                                                                                                                                                                                                                                lineNumberFormatter?: ((line: number) => string) | undefined;
                                                                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                                                                property lineNumbers

                                                                                                                                                                                                                                                                                lineNumbers?: boolean | undefined;
                                                                                                                                                                                                                                                                                • Whether to show line numbers to the left of the editor.

                                                                                                                                                                                                                                                                                property lineSeparator

                                                                                                                                                                                                                                                                                lineSeparator?: string | null | undefined;
                                                                                                                                                                                                                                                                                • Explicitly set the line separator for the editor. By default (value null), the document will be split on CRLFs as well as lone CRs and LFs, and a single LF will be used as line separator in all output (such as getValue). When a specific string is given, lines will only be split on that string, and output will, by default, use that same separator.

                                                                                                                                                                                                                                                                                property lineWiseCopyCut

                                                                                                                                                                                                                                                                                lineWiseCopyCut?: boolean | undefined;
                                                                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                                                                property lineWrapping

                                                                                                                                                                                                                                                                                lineWrapping?: boolean | undefined;
                                                                                                                                                                                                                                                                                • Whether CodeMirror should scroll or wrap for long lines. Defaults to false (scroll).

                                                                                                                                                                                                                                                                                property maxHighlightLength

                                                                                                                                                                                                                                                                                maxHighlightLength?: number | undefined;
                                                                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                                                                property mode

                                                                                                                                                                                                                                                                                mode?: string | ModeSpec<ModeSpecOptions> | undefined;
                                                                                                                                                                                                                                                                                • 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}).

                                                                                                                                                                                                                                                                                property onDragEvent

                                                                                                                                                                                                                                                                                onDragEvent?: ((instance: Editor, event: DragEvent) => boolean) | undefined;
                                                                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                                                                property onKeyEvent

                                                                                                                                                                                                                                                                                onKeyEvent?: ((instance: Editor, event: KeyboardEvent) => boolean) | undefined;
                                                                                                                                                                                                                                                                                • 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).

                                                                                                                                                                                                                                                                                property pasteLinesPerSelection

                                                                                                                                                                                                                                                                                pasteLinesPerSelection?: boolean | undefined;
                                                                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                                                                property phrases

                                                                                                                                                                                                                                                                                phrases?: { [s: string]: unknown } | undefined;
                                                                                                                                                                                                                                                                                • Some addons run user-visible strings (such as labels in the interface) through the phrase method to allow for translation. This option determines the return value of that method. When it is null or an object that doesn't have a property named by the input string, that string is returned. Otherwise, the value of the property corresponding to that string is returned.

                                                                                                                                                                                                                                                                                property pollInterval

                                                                                                                                                                                                                                                                                pollInterval?: number | undefined;
                                                                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                                                                property readOnly

                                                                                                                                                                                                                                                                                readOnly?: boolean | 'nocursor' | undefined;
                                                                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                                                                property resetSelectionOnContextMenu

                                                                                                                                                                                                                                                                                resetSelectionOnContextMenu?: boolean | undefined;
                                                                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                                                                property rtlMoveVisually

                                                                                                                                                                                                                                                                                rtlMoveVisually?: boolean | undefined;
                                                                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                                                                property screenReaderLabel

                                                                                                                                                                                                                                                                                screenReaderLabel?: string | undefined;
                                                                                                                                                                                                                                                                                • This label is read by the screenreaders when CodeMirror text area is focused. This is helpful for accessibility.

                                                                                                                                                                                                                                                                                property scrollbarStyle

                                                                                                                                                                                                                                                                                scrollbarStyle?: keyof ScrollbarModels | undefined;
                                                                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                                                                property selectionsMayTouch

                                                                                                                                                                                                                                                                                selectionsMayTouch?: boolean | undefined;
                                                                                                                                                                                                                                                                                • Determines whether multiple selections are joined as soon as they touch (the default) or only when they overlap (true).

                                                                                                                                                                                                                                                                                property showCursorWhenSelecting

                                                                                                                                                                                                                                                                                showCursorWhenSelecting?: boolean | undefined;
                                                                                                                                                                                                                                                                                • Whether the cursor should be drawn when a selection is active. Defaults to false.

                                                                                                                                                                                                                                                                                property smartIndent

                                                                                                                                                                                                                                                                                smartIndent?: boolean | undefined;
                                                                                                                                                                                                                                                                                • Whether to use the context-sensitive indentation that the mode provides (or just indent the same as the line before). Defaults to true.

                                                                                                                                                                                                                                                                                property specialCharPlaceholder

                                                                                                                                                                                                                                                                                specialCharPlaceholder?: ((char: string) => HTMLElement) | undefined;
                                                                                                                                                                                                                                                                                • A function that, given a special character identified by the specialChars option, produces a DOM node that is used to represent the character. By default, a red dot (•) is shown, with a title tooltip to indicate the character code.

                                                                                                                                                                                                                                                                                property specialChars

                                                                                                                                                                                                                                                                                specialChars?: RegExp | undefined;
                                                                                                                                                                                                                                                                                • A regular expression used to determine which characters should be replaced by a special placeholder. Mostly useful for non-printing special characters. The default is /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/.

                                                                                                                                                                                                                                                                                property spellcheck

                                                                                                                                                                                                                                                                                spellcheck?: boolean | undefined;
                                                                                                                                                                                                                                                                                • Specifies whether or not spellcheck will be enabled on the input.

                                                                                                                                                                                                                                                                                property tabindex

                                                                                                                                                                                                                                                                                tabindex?: number | undefined;
                                                                                                                                                                                                                                                                                • The tab index to assign to the editor. If not given, no tab index will be assigned.

                                                                                                                                                                                                                                                                                property tabSize

                                                                                                                                                                                                                                                                                tabSize?: number | undefined;
                                                                                                                                                                                                                                                                                • The width of a tab character. Defaults to 4.

                                                                                                                                                                                                                                                                                property theme

                                                                                                                                                                                                                                                                                theme?: string | undefined;
                                                                                                                                                                                                                                                                                • 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".

                                                                                                                                                                                                                                                                                property undoDepth

                                                                                                                                                                                                                                                                                undoDepth?: number | undefined;
                                                                                                                                                                                                                                                                                • The maximum number of undo levels that the editor stores. Defaults to 40.

                                                                                                                                                                                                                                                                                property value

                                                                                                                                                                                                                                                                                value?: string | Doc | undefined;
                                                                                                                                                                                                                                                                                • The starting value of the editor. Can be a string, or a document object.

                                                                                                                                                                                                                                                                                property viewportMargin

                                                                                                                                                                                                                                                                                viewportMargin?: number | undefined;
                                                                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                                                                property workDelay

                                                                                                                                                                                                                                                                                workDelay?: number | undefined;
                                                                                                                                                                                                                                                                                • See workTime.

                                                                                                                                                                                                                                                                                property workTime

                                                                                                                                                                                                                                                                                workTime?: number | undefined;
                                                                                                                                                                                                                                                                                • 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.

                                                                                                                                                                                                                                                                                interface EditorConfiguration

                                                                                                                                                                                                                                                                                interface EditorConfiguration {}

                                                                                                                                                                                                                                                                                  property continueComments

                                                                                                                                                                                                                                                                                  continueComments?:
                                                                                                                                                                                                                                                                                  | boolean
                                                                                                                                                                                                                                                                                  | string
                                                                                                                                                                                                                                                                                  | { key: string; continueLineComment?: boolean | undefined }
                                                                                                                                                                                                                                                                                  | undefined;
                                                                                                                                                                                                                                                                                  • if true, the editor will make the next line continue a comment when pressing the Enter key. If set to a string, it will continue comments using a custom shortcut.

                                                                                                                                                                                                                                                                                  interface EditorConfiguration

                                                                                                                                                                                                                                                                                  interface EditorConfiguration {}

                                                                                                                                                                                                                                                                                    property autoRefresh

                                                                                                                                                                                                                                                                                    autoRefresh?: boolean | { delay: number } | undefined;

                                                                                                                                                                                                                                                                                      interface EditorConfiguration

                                                                                                                                                                                                                                                                                      interface EditorConfiguration {}

                                                                                                                                                                                                                                                                                        property fullScreen

                                                                                                                                                                                                                                                                                        fullScreen?: boolean | undefined;

                                                                                                                                                                                                                                                                                        interface EditorConfiguration

                                                                                                                                                                                                                                                                                        interface EditorConfiguration {}

                                                                                                                                                                                                                                                                                          property placeholder

                                                                                                                                                                                                                                                                                          placeholder?: string | Node | undefined;
                                                                                                                                                                                                                                                                                          • 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.

                                                                                                                                                                                                                                                                                          interface EditorConfiguration

                                                                                                                                                                                                                                                                                          interface EditorConfiguration {}

                                                                                                                                                                                                                                                                                            property rulers

                                                                                                                                                                                                                                                                                            rulers?: false | ReadonlyArray<number | Ruler> | undefined;
                                                                                                                                                                                                                                                                                            • show one or more vertical rulers in the editor.

                                                                                                                                                                                                                                                                                            interface EditorConfiguration

                                                                                                                                                                                                                                                                                            interface EditorConfiguration {}

                                                                                                                                                                                                                                                                                              property autoCloseBrackets

                                                                                                                                                                                                                                                                                              autoCloseBrackets?: AutoCloseBrackets | boolean | string | undefined;
                                                                                                                                                                                                                                                                                              • 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.

                                                                                                                                                                                                                                                                                              interface EditorConfiguration

                                                                                                                                                                                                                                                                                              interface EditorConfiguration {}

                                                                                                                                                                                                                                                                                                property autoCloseTags

                                                                                                                                                                                                                                                                                                autoCloseTags?: AutoCloseTags | boolean | undefined;
                                                                                                                                                                                                                                                                                                • Will auto-close XML tags when '>' or '/' is typed. Depends on the fold/xml-fold.js addon.

                                                                                                                                                                                                                                                                                                interface EditorConfiguration

                                                                                                                                                                                                                                                                                                interface EditorConfiguration {}

                                                                                                                                                                                                                                                                                                  property matchBrackets

                                                                                                                                                                                                                                                                                                  matchBrackets?: MatchBrackets | boolean | undefined;

                                                                                                                                                                                                                                                                                                    interface EditorConfiguration

                                                                                                                                                                                                                                                                                                    interface EditorConfiguration {}

                                                                                                                                                                                                                                                                                                      property matchTags

                                                                                                                                                                                                                                                                                                      matchTags?: MatchTags | boolean | undefined;
                                                                                                                                                                                                                                                                                                      • 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.

                                                                                                                                                                                                                                                                                                      interface EditorConfiguration

                                                                                                                                                                                                                                                                                                      interface EditorConfiguration {}

                                                                                                                                                                                                                                                                                                        property showTrailingSpace

                                                                                                                                                                                                                                                                                                        showTrailingSpace?: boolean | undefined;
                                                                                                                                                                                                                                                                                                        • when enabled, adds the CSS class cm-trailingspace to stretches of whitespace at the end of lines.

                                                                                                                                                                                                                                                                                                        interface EditorConfiguration

                                                                                                                                                                                                                                                                                                        interface EditorConfiguration {}

                                                                                                                                                                                                                                                                                                          property foldOptions

                                                                                                                                                                                                                                                                                                          foldOptions?: FoldOptions | undefined;

                                                                                                                                                                                                                                                                                                            interface EditorConfiguration

                                                                                                                                                                                                                                                                                                            interface EditorConfiguration {}

                                                                                                                                                                                                                                                                                                              property foldGutter

                                                                                                                                                                                                                                                                                                              foldGutter?: boolean | FoldGutterOptions | undefined;
                                                                                                                                                                                                                                                                                                              • Provides an option foldGutter, which can be used to create a gutter with markers indicating the blocks that can be folded.

                                                                                                                                                                                                                                                                                                              interface EditorConfiguration

                                                                                                                                                                                                                                                                                                              interface EditorConfiguration <