Expand all

CodeMirrorMode

Abstract interface for CodeMirror modes.

Clients can unpack individual modes from the ext.CodeMirror.v6.modes module. Each mode is exposed as a method with the same name as the mode in the form of a LanguageSupport-like instance that is consumable by CodeMirror.

Example

const CodeMirror = require( 'ext.CodeMirror.v6' );
const { javascript } = require( 'ext.CodeMirror.v6.modes' );
const cm = new CodeMirror( myTextArea, javascript() );
cm.initialize();

Constructor

new CodeMirrorMode(name) #

Parameters:

Name Type Description
name string
Implements:
Source:

Properties

extension #

The complete set of extensions for this mode, including the language and any supporting extensions.

Source:

The complete set of extensions for this mode, including the language and any supporting extensions.

hasWorker #

Whether the mode should load a web worker.

Source:
Whether the mode should load a web worker.

language :Language #

The language object.

Type:

Source:
The language object.

lintSource :LintSource|undefined #

The function to lint the code in the editor.

Type:

Source:
The function to lint the code in the editor.

name :string #

The name of the mode.

Type:

  • string
Source:
The name of the mode.

support :Extension #

Supporting extensions.

Type:

Source:
Supporting extensions.

worker :CodeMirrorWorker|undefined #

The web worker for the mode, if any.

Type:

Source:
The web worker for the mode, if any.