Expand all

CodeMirrorWorker

Web worker for CodeMirror

Constructor

new CodeMirrorWorker(mode) #

Parameters:

Name Type Description
mode string
Source:

Properties

mode :string #

The mode for which the worker is created.

Type:

  • string
Source:
The mode for which the worker is created.

queue #

Queue of callbacks to be called when the worker is loaded.

Source:
Queue of callbacks to be called when the worker is loaded.

worker :Worker #

The web worker for the mode.

Type:

Source:
The web worker for the mode.

Methods

getConfig() → {Promise} #

Get the configuration for the worker.

Returns:

Type
Promise
Source:
Get the configuration for the worker.

getI18N() → {Promise} #

Get the localized messages for the worker.

Returns:

Type
Promise
Source:
Get the localized messages for the worker.

lint(view) → {Promise} #

Get lint diagnostics for the given document.

Parameters:

Name Type Description
view EditorView

Returns:

Type
Promise
Source:
Get lint diagnostics for the given document.

onload(callback) #

Add a callback to be called when the worker is loaded.

Parameters:

Name Type Description
callback function
Source:
Add a callback to be called when the worker is loaded.

setConfig(config) #

Set the configuration for the worker.

Parameters:

Name Type Description
config Object
Source:
Set the configuration for the worker.

setI18N(i18n) #

Set the localized messages for the worker.

Parameters:

Name Type Description
i18n Object
Source:
Set the localized messages for the worker.

setLintConfig(config) #

Set the linting configuration for the worker.

Parameters:

Name Type Description
config Object
Source:
Set the linting configuration for the worker.

pos(view, line, column) → {number}static #

Calculate the position in the document for a given line and column.

Parameters:

Name Type Description
view EditorView
line number
column number

Returns:

Type
number
Source:
Calculate the position in the document for a given line and column.