Codemirror- linting - Is there a event to trigger linting explictly?

codemirror, javascript

Solution

The lint addon adds an "extension" method to all Editor instances called `performLint`, combine with editor options of `lint: { lintOnChange: false }`, and then you can invoke the linter by calling `mirror.performLint()`.

If you define your own lint methods ala

CodeMirror.registerHelper('lint', 'mode', (text) => { /* your cool stuff here */ })

that'll get invoked on `performLint()`.

Problem

I am designing an application using CodeMirror that comes with toolbar. Because of performance reason, I am not executing the lint to either through async or asynch mode. I have provided an icon in the toolbar, on clicking this I am doing the parsing and constructing the errors. But I am stuck with how I can update lint error in editor? Any pointer would be really helpful.

Original source