Class orion.mirror.CodeMirrorStyler
A styler that uses CodeMirror modes to provide styles for a orion.editor.TextView.
Defined in: </shared/eclipse/e4/orion/I201404012230/bundles/org.eclipse.orion.client.editor/web/orion/editor/mirror.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
orion.mirror.CodeMirrorStyler(textView, codeMirror, annotationModel)
A
CodeMirrorStyler applies one or more CodeMirror modes to provide styles for a orion.editor.TextView. |
Method Attributes | Method Name and Description |
---|---|
destroy()
Deactivates this styler and removes its listeners.
|
|
setMode(modeSpec)
Sets the CodeMirror mode that this styler will use for styling the view.
|
CodeMirrorStyler
applies one or more CodeMirror modes to provide styles for a orion.editor.TextView.
It uses modes that are registered with the orion.mirror.Mirror object passed to the CodeMirrorStyler constructor.
The process for using CodeMirrorStyler is as follows:
- Create a orion.mirror.Mirror.
- Load the modes you want to use and register them with the
Mirror
using orion.mirror.Mirror#defineMode.Note that the modes included with CodeMirror expect a global variable named "CodeMirror" to be available. If you intend to use these modes without modification, you must first expose your Mirror as a global variable. See the orion.mirror.Mirror documentation for details.
- Call #setMode to tell the styler what mode to use for highlighting the view.
Note that the mode may refer to other modes to process nested language text. In such cases, you should ensure that all dependent modes have been registered with the Mirror before calling #setMode.
- Parameters:
- {orion.editor.TextView} textView
- The TextView to provide style for.
- {orion.mirror.Mirror} codeMirror
- The Mirror object to load modes from.
- {orion.editor.AnnotationModel} annotationModel Optional
- Parameters:
- {String} modeSpec
- Name of the mode to use (eg.
"css"
), or a MIME type defined by the mode (eg."text/css"
).