New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get yaml lint errors externally #5652

Closed
ChinmayeePDas opened this Issue Nov 8, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@ChinmayeePDas
Copy link

ChinmayeePDas commented Nov 8, 2018

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?

@marijnh

This comment has been minimized.

Copy link
Member

marijnh commented Nov 8, 2018

You have parentheses after self.yaml_validator, which will cause it to be called one, one load. You want to pass the function value, so remove those parentheses.

@marijnh marijnh closed this Nov 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment