use narcissus in the worker to detect syntax errors
This commit is contained in:
parent
bd7b145a7f
commit
d24cce4851
2 changed files with 30 additions and 3 deletions
|
|
@ -15,8 +15,31 @@ oop.inherits(JavaScriptWorker, Mirror);
|
|||
(function() {
|
||||
|
||||
this.onUpdate = function() {
|
||||
lint(this.doc.getValue(), {undef: false, onevar: false, passfail: false});
|
||||
this.sender.emit("jslint", lint.errors);
|
||||
var value = this.doc.getValue();
|
||||
|
||||
var start = new Date();
|
||||
var parser = require("ace/narcissus/jsparse");
|
||||
try {
|
||||
parser.parse(value);
|
||||
} catch(e) {
|
||||
console.log("narcissus")
|
||||
console.log(e);
|
||||
sender.emit("narcissus", {
|
||||
row: e.lineno-1,
|
||||
column: null, // TODO convert e.cursor
|
||||
text: e.message,
|
||||
type: "error"
|
||||
});
|
||||
return;
|
||||
} finally {
|
||||
console.log("parse time: " + (new Date() - start));
|
||||
}
|
||||
|
||||
var start = new Date();
|
||||
console.log("jslint")
|
||||
lint(value, {undef: false, onevar: false, passfail: false});
|
||||
this.sender.emit("jslint", lint.errors);
|
||||
console.log("lint time: " + (new Date() - start));
|
||||
}
|
||||
|
||||
}).call(JavaScriptWorker.prototype);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue