This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
orbit-4-1/app/assets/javascripts/codemirror/addon/lint/json-lint.js

15 lines
448 B
JavaScript
Raw Normal View History

2013-07-22 08:31:44 +00:00
// Depends on jsonlint.js from https://github.com/zaach/jsonlint
CodeMirror.jsonValidator = function(text) {
var found = [];
jsonlint.parseError = function(str, hash) {
var loc = hash.loc;
found.push({from: CodeMirror.Pos(loc.first_line - 1, loc.first_column),
to: CodeMirror.Pos(loc.last_line - 1, loc.last_column),
message: str});
};
try { jsonlint.parse(text); }
catch(e) {}
return found;
};