mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Changes to ACE editor annotations
relax errors for missing semi-colons, [] syntax warnings, max errors. And also ignore missing doctype error for html templates.
This commit is contained in:
parent
4453a51211
commit
4adafb6d1e
@ -2389,6 +2389,16 @@ RED.editor = (function() {
|
||||
var editor = ace.edit(options.id);
|
||||
editor.setTheme("ace/theme/tomorrow");
|
||||
var session = editor.getSession();
|
||||
session.on("changeAnnotation", function () {
|
||||
var annotations = session.getAnnotations() || [];
|
||||
var i = annotations.length;
|
||||
var len = annotations.length;
|
||||
while (i--) {
|
||||
if (/doctype first\. Expected/.test(annotations[i].text)) { annotations.splice(i, 1); }
|
||||
else if (/Unexpected End of file\. Expected/.test(annotations[i].text)) { annotations.splice(i, 1); }
|
||||
}
|
||||
if (len > annotations.length) { session.setAnnotations(annotations); }
|
||||
});
|
||||
if (options.mode) {
|
||||
session.setMode(options.mode);
|
||||
}
|
||||
@ -2419,7 +2429,7 @@ RED.editor = (function() {
|
||||
if (options.globals) {
|
||||
setTimeout(function() {
|
||||
if (!!session.$worker) {
|
||||
session.$worker.send("setOptions", [{globals: options.globals, esversion:6}]);
|
||||
session.$worker.send("setOptions", [{globals: options.globals, esversion:6, sub:true, asi:true, maxerr:1000}]);
|
||||
}
|
||||
},100);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user