Skip to content

Commit

Permalink
Few new tips, and errors => warnings, plus notify of fatal error.
Browse files Browse the repository at this point in the history
  • Loading branch information
remy committed Jun 23, 2011
1 parent a586b88 commit 224e1ca
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
2.8.3 2.8.4
30 changes: 12 additions & 18 deletions js/chrome/errors.js
Expand Up @@ -36,11 +36,13 @@ JSHINT._data = JSHINT.data;
JSHINT.data = function (onlyErrors) { JSHINT.data = function (onlyErrors) {
var data = JSHINT._data(), var data = JSHINT._data(),
errors = []; errors = [];

if (onlyErrors && data.errors) { if (onlyErrors && data.errors) {
for (var i = 0; i < data.errors.length; i++) { for (var i = 0; i < data.errors.length; i++) {
if (data.errors[i] !== null && data.errors[i].evidence) { // ignore JSHINT just quitting if (data.errors[i] !== null && data.errors[i].evidence) { // ignore JSHINT just quitting
errors.push(data.errors[i]); errors.push(data.errors[i]);
} else if (data.errors[i] !== null && data.errors[i].reason.indexOf('Stopping') === 0) {
errors.push('Fatal errors, unable to continue');
} }
} }
return { return {
Expand All @@ -52,26 +54,14 @@ JSHINT.data = function (onlyErrors) {
} }
}; };


// $error.tipsy({
// title: function () {
// var html = ['<ul>'],
// errors = JSHINT.data(true).errors;
// for (var i = 0; i < errors.length; i++) {
// html.push('Line ' + errors[i].line + ': ' + errors[i].evidence + ' --- ' + errors[i].reason);
// }
//
// return html.join('<li>') + '</ul>';
// },
// gravity: 'nw',
// html: true
// });

$error.delegate('li', 'click', function () { $error.delegate('li', 'click', function () {
var errors = JSHINT.data(true).errors; var errors = JSHINT.data(true).errors;
if (errors.length) { if (errors.length) {
var i = $error.find('li').index(this); var i = $error.find('li').index(this);
editors.javascript.setSelection({ line: errors[i].line - 1, ch: 0 }, { line: errors[i].line - 1 }); if (errors[i].reason) {
editors.javascript.focus(); editors.javascript.setSelection({ line: errors[i].line - 1, ch: 0 }, { line: errors[i].line - 1 });
editors.javascript.focus();
}
// var line = editors.javascript.nthLine(errors[0].line); // var line = editors.javascript.nthLine(errors[0].line);
// editors.javascript.jumpToLine(line); // editors.javascript.jumpToLine(line);
// editors.javascript.selectLines(line, 0, editors.javascript.nthLine(errors[0].line + 1), 0); // editors.javascript.selectLines(line, 0, editors.javascript.nthLine(errors[0].line + 1), 0);
Expand All @@ -92,7 +82,11 @@ var checkForErrors = function () {
var html = ['<ol>'], var html = ['<ol>'],
errors = jshintErrors.errors; errors = jshintErrors.errors;
for (var i = 0; i < errors.length; i++) { for (var i = 0; i < errors.length; i++) {
html.push('Line ' + errors[i].line + ': ' + errors[i].evidence + ' --- ' + errors[i].reason); if (typeof errors[i] == 'string') {
html.push(errors[i]);
} else {
html.push('Line ' + errors[i].line + ': ' + errors[i].evidence + ' --- ' + errors[i].reason);
}
} }


html = html.join('<li>') + '</ol>'; html = html.join('<li>') + '</ol>';
Expand Down
6 changes: 5 additions & 1 deletion tips.json
@@ -1,5 +1,9 @@
// feel free to add tips to this file to help other users - just append to the end // feel free to add tips to this file to help other users - just append to the end
[ [
'Use ctrl+shift+? to show the keyboard shortcuts', 'Use ctrl+shift+? to show the keyboard shortcuts',
'Make sure you check out the help and tutorials - a blog of screencasts' 'Make sure you check out the help and tutorials - a blog of screencasts',
'To only show the HTML panel use #html on the end of the url, such as http://jsbin.com/#html',
'Refreshing the window will not lose your changes.',
'Use console.log to display debug information. If a web console is present, then the logging goes there, otherwise it will show in a custom console window.',
'To view only the JavaScript append /js to the url, i.e. http://jsbin.com/ujayi/js - useful for Ajax testing'
] ]

0 comments on commit 224e1ca

Please sign in to comment.