Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Merge release back into master (fixes #6676)
Browse files Browse the repository at this point in the history
Conflicts:
	src/extensions/default/JSLint/main.js
  • Loading branch information
dangoor committed Jan 30, 2014
2 parents eb0d648 + 49789f5 commit aba95ef
Show file tree
Hide file tree
Showing 3 changed files with 391 additions and 152 deletions.
17 changes: 15 additions & 2 deletions src/extensions/default/JSLint/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,20 @@ define(function (require, exports, module) {

var prefs = PreferencesManager.getExtensionPrefs("jslint");

/**
* @private
*
* Used to keep track of the last options JSLint was run with to avoid running
* again when there were no changes.
*/
var _lastRunOptions;

prefs.definePreference("options", "object")
.on("change", function (e, data) {
CodeInspection.requestRun(Strings.JSLINT_NAME);
var options = prefs.get("options");
if (!_.isEqual(options, _lastRunOptions)) {
CodeInspection.requestRun(Strings.JSLINT_NAME);
}
});

// Predefined environments understood by JSLint.
Expand All @@ -54,7 +65,6 @@ define(function (require, exports, module) {
* a gold star when no errors are found.
*/
function lintOneFile(text, fullPath) {

// If a line contains only whitespace, remove the whitespace
// This should be doable with a regexp: text.replace(/\r[\x20|\t]+\r/g, "\r\r");,
// but that doesn't work.
Expand All @@ -67,6 +77,7 @@ define(function (require, exports, module) {
text = arr.join("\n");

var options = prefs.get("options");

if (!options) {
options = {};
} else {
Expand All @@ -86,6 +97,8 @@ define(function (require, exports, module) {
if (!hasEnvironment) {
options.browser = true;
}

_lastRunOptions = _.clone(options);

var jslintResult = JSLINT(text, options);

Expand Down
12 changes: 11 additions & 1 deletion src/language/CodeInspection.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ define(function (require, exports, module) {
* @private
* @type {boolean}
*/
var _enabled = true;
var _enabled = false;

/**
* When collapsed, the errors panel is closed but the status bar icon is kept up to date.
Expand Down Expand Up @@ -434,6 +434,12 @@ define(function (require, exports, module) {
if (enabled === undefined) {
enabled = !_enabled;
}

// Take no action when there is no change.
if (enabled === _enabled) {
return;
}

_enabled = enabled;

CommandManager.get(Commands.VIEW_TOGGLE_INSPECTION).setChecked(_enabled);
Expand All @@ -459,6 +465,10 @@ define(function (require, exports, module) {
if (collapsed === undefined) {
collapsed = !_collapsed;
}

if (collapsed === _collapsed) {
return;
}

_collapsed = collapsed;
if (!doNotSave) {
Expand Down
Loading

0 comments on commit aba95ef

Please sign in to comment.