Hi,
I have a XML validation system with XSD. This validation system returns an array of errors like this :
array[0][‘message’]
array[0][‘line’]
array[0][‘column’]
array[0][‘code’]
I wanna add things like this
on line i’ve got in my array.
How can i do this ?
Fixed !
function highlightError(errors) {
myCodeMirror.clearGutter('gutter-error');
for(var i=0;i<errors.length;i++) {
var error = errors[i];
var errorLine = error['line'] - 1;
var marker = document.createElement("div");
marker.setAttribute('class', 'CodeMirror-lint-marker-error');
marker.setAttribute('data-toggle', 'tooltip');
marker.setAttribute('data-placement', 'right');
marker.setAttribute('title', '(Error '+ error['code'] +') '+ error['message']);
myCodeMirror.setGutterMarker(errorLine,'gutter-error',marker);
}
$('[data-toggle="tooltip"]').tooltip();
}
Result :
