This repository has been archived on 2024-03-16. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
orbit-4-1/app/assets/javascripts/codemirror/addon/lint/json-lint.js
T
2013-07-22 16:31:44 +08:00

15 lines
448 B
JavaScript

// 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;
};