I am currently building a code editor with a custom mode.
This is how it is defined:
let codeMirror = CodeMirror.fromTextArea(textArea,
{
mode: "customMode",
lint: true,
theme: customtheme,
}
I then create a custom linter, defined as:
CodeMirror.registerHelper("lint", "customMode", function (text) {
// the "myLint()" function returns an array of error objects
// each object has a "from", "to", "severity", and "message" property
let errorsArray = myLint(text)
return errorsArray ;
});
If run the command
console.log(CodeMirror.lint.customMode(code));
An array of error objects is printed to the console, each with a “to”, “from”, “severity” and “message” property. What I’m wondering is, how do I use this function so that these errors can be underlined in red in the code editor?
Thank you