small cleanup
This commit is contained in:
parent
a44236cfcc
commit
828e445a27
2 changed files with 47 additions and 36 deletions
|
|
@ -12,9 +12,9 @@
|
||||||
|
|
||||||
.ace_content {
|
.ace_content {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
box-sizing: border-box;
|
|
||||||
-moz-box-sizing: border-box;
|
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
cursor: text;
|
cursor: text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -121,9 +121,9 @@
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
box-sizing: border-box;
|
|
||||||
-moz-box-sizing: border-box;
|
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
/* setting pointer-events: auto; on node under the mouse, which changes
|
/* setting pointer-events: auto; on node under the mouse, which changes
|
||||||
during scroll, will break mouse wheel scrolling in Safari */
|
during scroll, will break mouse wheel scrolling in Safari */
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
|
@ -190,15 +190,15 @@
|
||||||
.ace_marker-layer .ace_selected_word {
|
.ace_marker-layer .ace_selected_word {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 4;
|
z-index: 4;
|
||||||
box-sizing: border-box;
|
|
||||||
-moz-box-sizing: border-box;
|
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace_line .ace_fold {
|
.ace_line .ace_fold {
|
||||||
box-sizing: border-box;
|
|
||||||
-moz-box-sizing: border-box;
|
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
height: 11px;
|
height: 11px;
|
||||||
|
|
@ -213,9 +213,9 @@
|
||||||
color: transparent;
|
color: transparent;
|
||||||
|
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
-moz-border-radius: 2px;
|
|
||||||
-webkit-border-radius: 2px;
|
-webkit-border-radius: 2px;
|
||||||
border-radius: 2px;
|
-moz-border-radius: 2px;
|
||||||
|
border-radius: 2px;
|
||||||
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
|
|
@ -245,10 +245,11 @@
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 300;
|
z-index: 300;
|
||||||
box-sizing: border-box;
|
|
||||||
-moz-box-sizing: border-box;
|
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
|
white-space: pre-wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace_folding-enabled > .ace_gutter-cell {
|
.ace_folding-enabled > .ace_gutter-cell {
|
||||||
|
|
@ -256,9 +257,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace_fold-widget {
|
.ace_fold-widget {
|
||||||
box-sizing: border-box;
|
|
||||||
-moz-box-sizing: border-box;
|
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
margin: 0 -12px 0 1px;
|
margin: 0 -12px 0 1px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
@ -285,17 +286,17 @@
|
||||||
.ace_fold-widget:hover {
|
.ace_fold-widget:hover {
|
||||||
border: 1px solid rgba(0, 0, 0, 0.3);
|
border: 1px solid rgba(0, 0, 0, 0.3);
|
||||||
background-color: rgba(255, 255, 255, 0.2);
|
background-color: rgba(255, 255, 255, 0.2);
|
||||||
-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
|
|
||||||
-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
|
-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
|
||||||
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
|
-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
|
||||||
|
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace_fold-widget:active {
|
.ace_fold-widget:active {
|
||||||
border: 1px solid rgba(0, 0, 0, 0.4);
|
border: 1px solid rgba(0, 0, 0, 0.4);
|
||||||
background-color: rgba(0, 0, 0, 0.05);
|
background-color: rgba(0, 0, 0, 0.05);
|
||||||
-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
|
|
||||||
-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
|
-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
|
||||||
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
|
-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
|
||||||
|
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Dark version for fold widgets
|
* Dark version for fold widgets
|
||||||
|
|
@ -314,9 +315,9 @@
|
||||||
background-color: rgba(255, 255, 255, 0.1);
|
background-color: rgba(255, 255, 255, 0.1);
|
||||||
}
|
}
|
||||||
.ace_dark .ace_fold-widget:active {
|
.ace_dark .ace_fold-widget:active {
|
||||||
-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
|
|
||||||
-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
|
-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
|
||||||
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
|
-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
|
||||||
|
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -327,19 +328,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace_fade-fold-widgets .ace_fold-widget {
|
.ace_fade-fold-widgets .ace_fold-widget {
|
||||||
-moz-transition: opacity 0.4s ease 0.05s;
|
|
||||||
-webkit-transition: opacity 0.4s ease 0.05s;
|
-webkit-transition: opacity 0.4s ease 0.05s;
|
||||||
-o-transition: opacity 0.4s ease 0.05s;
|
-moz-transition: opacity 0.4s ease 0.05s;
|
||||||
-ms-transition: opacity 0.4s ease 0.05s;
|
-ms-transition: opacity 0.4s ease 0.05s;
|
||||||
|
-o-transition: opacity 0.4s ease 0.05s;
|
||||||
transition: opacity 0.4s ease 0.05s;
|
transition: opacity 0.4s ease 0.05s;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace_fade-fold-widgets:hover .ace_fold-widget {
|
.ace_fade-fold-widgets:hover .ace_fold-widget {
|
||||||
-moz-transition: opacity 0.05s ease 0.05s;
|
|
||||||
-webkit-transition: opacity 0.05s ease 0.05s;
|
-webkit-transition: opacity 0.05s ease 0.05s;
|
||||||
-o-transition: opacity 0.05s ease 0.05s;
|
-moz-transition: opacity 0.05s ease 0.05s;
|
||||||
-ms-transition: opacity 0.05s ease 0.05s;
|
-ms-transition: opacity 0.05s ease 0.05s;
|
||||||
|
-o-transition: opacity 0.05s ease 0.05s;
|
||||||
transition: opacity 0.05s ease 0.05s;
|
transition: opacity 0.05s ease 0.05s;
|
||||||
opacity:1;
|
opacity:1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ var errorsRe = startRegex([
|
||||||
"Unexpected",
|
"Unexpected",
|
||||||
"Expected ",
|
"Expected ",
|
||||||
"Confusing (plus|minus)",
|
"Confusing (plus|minus)",
|
||||||
"{a} unterminated regular expression",
|
"\\{a\\} unterminated regular expression",
|
||||||
"Unclosed ",
|
"Unclosed ",
|
||||||
"Unmatched ",
|
"Unmatched ",
|
||||||
"Unbegun comment",
|
"Unbegun comment",
|
||||||
|
|
@ -61,6 +61,7 @@ var infoRe = startRegex([
|
||||||
"Unexpected comma",
|
"Unexpected comma",
|
||||||
"Unexpected space",
|
"Unexpected space",
|
||||||
"Missing radix parameter.",
|
"Missing radix parameter.",
|
||||||
|
"\\['\\{a\\}'\\] is better written in dot notation."
|
||||||
]);
|
]);
|
||||||
|
|
||||||
var JavaScriptWorker = exports.JavaScriptWorker = function(sender) {
|
var JavaScriptWorker = exports.JavaScriptWorker = function(sender) {
|
||||||
|
|
@ -76,15 +77,20 @@ oop.inherits(JavaScriptWorker, Mirror);
|
||||||
this.options = options || {
|
this.options = options || {
|
||||||
// undef: true,
|
// undef: true,
|
||||||
// unused: true,
|
// unused: true,
|
||||||
|
es5: true,
|
||||||
|
esnext: true,
|
||||||
devel: true,
|
devel: true,
|
||||||
browser: true,
|
browser: true,
|
||||||
node: true,
|
node: true,
|
||||||
laxcomma: true,
|
laxcomma: true,
|
||||||
laxbreak: true,
|
laxbreak: true,
|
||||||
|
lastsemic: true,
|
||||||
onevar: false,
|
onevar: false,
|
||||||
passfail: false,
|
passfail: false,
|
||||||
maxerr: 100,
|
maxerr: 100,
|
||||||
expr: true
|
expr: true,
|
||||||
|
multistr: true,
|
||||||
|
globalstrict: true
|
||||||
};
|
};
|
||||||
this.doc.getValue() && this.deferredUpdate.schedule(100);
|
this.doc.getValue() && this.deferredUpdate.schedule(100);
|
||||||
};
|
};
|
||||||
|
|
@ -94,6 +100,17 @@ oop.inherits(JavaScriptWorker, Mirror);
|
||||||
this.doc.getValue() && this.deferredUpdate.schedule(100);
|
this.doc.getValue() && this.deferredUpdate.schedule(100);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.isValidJS = function(str) {
|
||||||
|
try {
|
||||||
|
// evaluated code can only create variables in this function
|
||||||
|
eval("throw 0;" + str);
|
||||||
|
} catch(e) {
|
||||||
|
if (e === 0)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
};
|
||||||
|
|
||||||
this.onUpdate = function() {
|
this.onUpdate = function() {
|
||||||
var value = this.doc.getValue();
|
var value = this.doc.getValue();
|
||||||
value = value.replace(/^#!.*\n/, "\n");
|
value = value.replace(/^#!.*\n/, "\n");
|
||||||
|
|
@ -105,14 +122,7 @@ oop.inherits(JavaScriptWorker, Mirror);
|
||||||
|
|
||||||
// jshint reports many false errors
|
// jshint reports many false errors
|
||||||
// report them as error only if code is actually invalid
|
// report them as error only if code is actually invalid
|
||||||
var maxErrorLevel = "warning";
|
var maxErrorLevel = this.isValidJS(value) ? "warning" : "error";
|
||||||
try {
|
|
||||||
eval("throw 0;" + value);
|
|
||||||
} catch(e) {
|
|
||||||
if (e != 0) {
|
|
||||||
maxErrorLevel = "error";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// var start = new Date();
|
// var start = new Date();
|
||||||
lint(value, this.options);
|
lint(value, this.options);
|
||||||
|
|
@ -129,7 +139,7 @@ oop.inherits(JavaScriptWorker, Mirror);
|
||||||
if (raw == "Missing semicolon.") {
|
if (raw == "Missing semicolon.") {
|
||||||
var str = error.evidence.substr(error.character);
|
var str = error.evidence.substr(error.character);
|
||||||
str = str.charAt(str.search(/\S/));
|
str = str.charAt(str.search(/\S/));
|
||||||
if (maxErrorLevel == "error" && str && /[\w\d{([]/.test(str)) {
|
if (maxErrorLevel == "error" && str && /[\w\d{(['"]/.test(str)) {
|
||||||
error.reason = 'Missing ";" before statement';
|
error.reason = 'Missing ";" before statement';
|
||||||
type = "error";
|
type = "error";
|
||||||
} else
|
} else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue