Files
luos/gulliver/js/codemirror/addon/lint/json-lint.js
jennylee 5d3d7392f0 New CodeMirror Library version 3.16
Replacing the CodeMirror Version to 3.16
Adding files to ..templates/designer/index.html to  use the new extended control codeMirror.js and codeMirrorField.js
2014-02-13 15:19:17 -04:00

18 lines
556 B
JavaScript

// Depends on jsonlint.js from https://github.com/zaach/jsonlint
// declare global: jsonlint
CodeMirror.registerHelper("lint", "json", 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;
});
CodeMirror.jsonValidator = CodeMirror.lint.json; // deprecated