X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=third-party%2Fcodemirror-3.15%2Faddon%2Flint%2Fjson-lint.js;fp=third-party%2Fcodemirror-3.15%2Faddon%2Flint%2Fjson-lint.js;h=1dfc6b8fdc81b5abe0f7df52bfe3a15cd98b27ed;hb=75d3bceb8e1d168e83982f910a916aee3bab7981;hp=0000000000000000000000000000000000000000;hpb=302dd5bda1297ed6579ca26da35ee67f8d35d934;p=unfold.git diff --git a/third-party/codemirror-3.15/addon/lint/json-lint.js b/third-party/codemirror-3.15/addon/lint/json-lint.js new file mode 100644 index 00000000..1dfc6b8f --- /dev/null +++ b/third-party/codemirror-3.15/addon/lint/json-lint.js @@ -0,0 +1,15 @@ +// Depends on jsonlint.js from https://github.com/zaach/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