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.
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()
.
Have you tried setting the lint value dynamically using the below code?
//enable
editor.setOption("lint",true);
//disable
editor.setOption("lint",false);
You can see a demo here JSFiddle link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With