From 0f989f249ff6897e18d761808ee30a578b805baf Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Wed, 12 Dec 2012 09:23:02 +0000 Subject: [PATCH] Moving function to the info & display section --- lib/ice-coder.js | 67 ++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/lib/ice-coder.js b/lib/ice-coder.js index 5725cf1..0f669ae 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -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-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); - } - } } }; \ No newline at end of file