mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-06 00:34:00 +01:00
Moving function to the info & display section
This commit is contained in:
@@ -1147,6 +1147,40 @@ var ICEcoder = {
|
||||
return i!=-1 ? i : false;
|
||||
},
|
||||
|
||||
// Show JS Hint errors
|
||||
updateHints: function() {
|
||||
var cM;
|
||||
|
||||
if (top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1].indexOf('.js')>-1) {
|
||||
cM = ICEcoder.getcMInstance();
|
||||
cM.operation(function(){
|
||||
var widgets = top.ICEcoder['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]+'widgets'];
|
||||
for (var i=0; i<widgets.length; ++i) {
|
||||
cM.removeLineWidget(widgets[i]);
|
||||
}
|
||||
widgets.length = 0;
|
||||
|
||||
JSHINT(cM.getValue());
|
||||
for (var i=0; i<JSHINT.errors.length; ++i) {
|
||||
var err = JSHINT.errors[i];
|
||||
if (!err) continue;
|
||||
var msg = document.createElement("div");
|
||||
var icon = msg.appendChild(document.createElement("span"));
|
||||
icon.innerHTML = "!!";
|
||||
icon.className = "lint-error-icon";
|
||||
msg.appendChild(document.createTextNode(err.reason));
|
||||
msg.className = "lint-error";
|
||||
widgets.push(cM.addLineWidget(err.line-1, msg, {coverGutter: false, noHScroll: true}));
|
||||
}
|
||||
});
|
||||
var info = cM.getScrollInfo();
|
||||
var after = cM.charCoords({line: cM.getCursor().line+1, ch: 0}, "local").top;
|
||||
if (info.top + info.clientHeight < after) {
|
||||
cM.scrollTo(null, after - info.clientHeight+3);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// ==============
|
||||
// SYSTEM
|
||||
// ==============
|
||||
@@ -1745,38 +1779,5 @@ var ICEcoder = {
|
||||
if (key==17) {top.ICEcoder.ctrlKeyDown = false; top.ICEcoder.stickyTabMaybe = false}
|
||||
if (key==16) {top.ICEcoder.shiftKeyDown = false}
|
||||
if (key==46) {top.ICEcoder.delKeyDown = false}
|
||||
},
|
||||
|
||||
updateHints: function() {
|
||||
var cM;
|
||||
|
||||
if (top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1].indexOf('.js')>-1) {
|
||||
cM = ICEcoder.getcMInstance();
|
||||
cM.operation(function(){
|
||||
var widgets = top.ICEcoder['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]+'widgets'];
|
||||
for (var i = 0; i < widgets.length; ++i) {
|
||||
cM.removeLineWidget(widgets[i]);
|
||||
}
|
||||
widgets.length = 0;
|
||||
|
||||
JSHINT(cM.getValue());
|
||||
for (var i = 0; i < JSHINT.errors.length; ++i) {
|
||||
var err = JSHINT.errors[i];
|
||||
if (!err) continue;
|
||||
var msg = document.createElement("div");
|
||||
var icon = msg.appendChild(document.createElement("span"));
|
||||
icon.innerHTML = "!!";
|
||||
icon.className = "lint-error-icon";
|
||||
msg.appendChild(document.createTextNode(err.reason));
|
||||
msg.className = "lint-error";
|
||||
widgets.push(cM.addLineWidget(err.line - 1, msg, {coverGutter: false, noHScroll: true}));
|
||||
}
|
||||
});
|
||||
var info = cM.getScrollInfo();
|
||||
var after = cM.charCoords({line: cM.getCursor().line + 1, ch: 0}, "local").top;
|
||||
if (info.top + info.clientHeight < after) {
|
||||
cM.scrollTo(null, after - info.clientHeight + 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user