Files
luos/gulliver/js/codemirror/addon/lint/coffeescript-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

28 lines
882 B
JavaScript

// Depends on coffeelint.js from http://www.coffeelint.org/js/coffeelint.js
// declare global: coffeelint
CodeMirror.registerHelper("lint", "coffeescript", function(text) {
var found = [];
var parseError = function(err) {
var loc = err.lineNumber;
found.push({from: CodeMirror.Pos(loc-1, 0),
to: CodeMirror.Pos(loc, 0),
severity: err.level,
message: err.message});
};
try {
var res = coffeelint.lint(text);
for(var i = 0; i < res.length; i++) {
parseError(res[i]);
}
} catch(e) {
found.push({from: CodeMirror.Pos(e.location.first_line, 0),
to: CodeMirror.Pos(e.location.last_line, e.location.last_column),
severity: 'error',
message: e.message});
}
return found;
});
CodeMirror.coffeeValidator = CodeMirror.lint.coffeescript; // deprecated