Skip to content

Commit

Permalink
Set preferences are, by default, set in the context in which they are…
Browse files Browse the repository at this point in the history
… defined.

For example, if a preference is set at the "user" level and the user changes
the value via UI, the preference will be changed at the "user" level. If it's
set in a .brackets.json file, the preference will be changed there.
If the preference is defined only at the "default" level, it will be set
at the next higher level of precedence ("user" level in our setup).

This is a fix for #6595.
  • Loading branch information
dangoor committed Jan 21, 2014
1 parent 0e52dbd commit e4c86c2
Show file tree
Hide file tree
Showing 7 changed files with 586 additions and 56 deletions.
3 changes: 2 additions & 1 deletion .brackets.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
"linting.enabled": false
}
},
"spaceUnits": 4
"spaceUnits": 4,
"useTabChar": false
}
2 changes: 1 addition & 1 deletion src/editor/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -1552,7 +1552,7 @@ define(function (require, exports, module) {
function _setEditorOptionAndPref(value, cmOption, prefName, _editorOnly) {
_setEditorOption(value, cmOption);
if (!_editorOnly) {
PreferencesManager.setValueAndSave("user", prefName, value);
PreferencesManager.setValueAndSave(prefName, value);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/extensions/default/QuickView/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ define(function (require, exports, module) {
hidePreview();
}
if (!doNotSave) {
prefs.set("user", "enabled", enabled);
prefs.set("enabled", enabled);
prefs.save();
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/language/CodeInspection.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ define(function (require, exports, module) {
(error.codeSnippet = currentDoc.getLine(error.pos.line)) !== undefined) {
error.friendlyLine = error.pos.line + 1;
error.codeSnippet = error.codeSnippet.substr(0, Math.min(175, error.codeSnippet.length)); // limit snippet width
}
}

if (error.type !== Type.META) {
numProblems++;
Expand Down Expand Up @@ -439,7 +439,7 @@ define(function (require, exports, module) {
CommandManager.get(Commands.VIEW_TOGGLE_INSPECTION).setChecked(_enabled);
updateListeners();
if (!doNotSave) {
prefs.set("user", PREF_ENABLED, _enabled);
prefs.set(PREF_ENABLED, _enabled);
prefs.save();
}

Expand All @@ -462,7 +462,7 @@ define(function (require, exports, module) {

_collapsed = collapsed;
if (!doNotSave) {
prefs.set("user", PREF_COLLAPSED, _collapsed);
prefs.set(PREF_COLLAPSED, _collapsed);
prefs.save();
}

Expand Down
2 changes: 1 addition & 1 deletion src/preferences/PreferenceStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ define(function (require, exports, module) {
var parts = rule.split(" ");
if (parts[0] === "user") {
var newKey = parts.length > 1 ? parts[1] : key;
PreferencesManager.set("user", newKey, prefs[key]);
PreferencesManager.set(newKey, prefs[key]);
convertedKeys.push(key);
}
} else {
Expand Down
Loading

0 comments on commit e4c86c2

Please sign in to comment.