Structured Text language support, includes syntax highlight based on IEC 61131-3.
This package implements iecst language support for the CodeMirror code editor.
setup(options: SetupOptions): Extension[]
provide an example configuration for the editoriecst(): LanguageSupport
iecst language support, includes syntax highlightautocomplete(): Extension
code completionbreakpointGutter(): Extension
allow breakpointsgetMarkLines(view: EditorView): Line[]
get lines where breakpoints are located
// All default values are true.
interface SetupOptions {
lineNumbers: boolean;
highlightActiveLineGutter: boolean;
highlightSpecialChars: boolean;
history: boolean;
foldGutter: boolean;
drawSelection: boolean;
dropCursor: boolean;
allowMultipleSelections: boolean;
indentOnInput: boolean;
syntaxHighlighting: boolean;
bracketMatching: boolean;
closeBrackets: boolean;
autocompletion: boolean;
rectangularSelection: boolean;
crosshairCursor: boolean;
highlightActiveLine: boolean;
highlightSelectionMatches: boolean;
keymap: boolean;
breakpointGutter: boolean;
}
$ npm install codemirror-iecst
import React, { useEffect, useRef } from 'react';
import { setup } from 'codemirror-iecst';
import { EditorView } from 'codemirror';
import { EditorState } from '@codemirror/state';
const StructuredTextEditor: React.FC = () => {
const editorRef = useRef<HTMLDivElement>(null);
useEffect(() => {
const state = EditorState.create({
doc: "PROGRAM END_PROGRAM",
extensions: [
setup()
]
});
const editor = new EditorView({
state,
parent: editorRef.current as HTMLDivElement
});
return () => {
editor.destroy();
};
}, []);
return (
<div ref={editorRef}></div>
);
};