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

[JSLint] Respects tabSize setting when useTabChar is true #7243

Merged
merged 2 commits into from
Mar 21, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/extensions/default/JSLint/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ define(function (require, exports, module) {
// Predefined environments understood by JSLint.
var ENVIRONMENTS = ["browser", "node", "couch", "rhino"];

// gets indentation size depending whether the tabs or spaces are used
function _getIndentSize(fullPath) {
return PreferencesManager.get(
PreferencesManager.get("useTabChar", fullPath) ? "tabSize" : "spaceUnits",
fullPath
);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already fixed this in PR #7186, but the file path should be passed to PreferencesManager.get():

    function _getIndentSize(fullPath) {
        return PreferencesManager.get(
            PreferencesManager.get("useTabChar", fullPath) ? "tabSize" : "spaceUnits",
            fullPath
        );
    }

Then pass "fullPath" to this function below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I can update once #7186 gets merged or you can close this and include it there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem. Proceed with this fix and we can merge changes when necessary.

/**
* Run JSLint on the current document. Reports results to the main UI. Displays
* a gold star when no errors are found.
Expand Down Expand Up @@ -88,7 +96,7 @@ define(function (require, exports, module) {

if (!options.indent) {
// default to using the same indentation value that the editor is using
options.indent = PreferencesManager.get("spaceUnits");
options.indent = _getIndentSize(fullPath);
}

// If the user has not defined the environment, we use browser by default.
Expand Down