get yaml validation errors externally for programatic usage


#1

I am using codemirror in yaml mode.
I have enabled linting and below is my config

lineNumbers: true,
mode: ‘text/x-yaml’,
gutters: [“CodeMirror-linenumbers”, “CodeMirror-foldgutter”, “CodeMirror-lint-markers”],
foldGutter: {
rangeFinder: new CodeMirror.fold.combine(CodeMirror.fold.indent, CodeMirror.fold.comment)
},
“lint”: {
“getAnnotations”: self.yaml_validator()
}

I want validation to happen on every change in the editor.
When i click on a button, i want to ensure that the functionality gets executed only when there are no errors in the yaml.

I found that ‘getAnnotations’ is helpful for this.
Added it in my config above.
I see that on page load, yaml_validator() method is getting called, but when i add some new content to the editor, it does not get invoked.

Please let me know how what am i doing wrong here?


#2

See https://github.com/codemirror/CodeMirror/issues/5652, and please stop spamming the same questions over multiple channels.


#3

Thank you. I was not aware that you are the one who manages both the sites