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

Commit ba1427c

Browse files
committed
Fix language switcher persistence to work when no custom file extension
mappings are set yet - don't leave default value of pref undefined. Clarify two other cases of definePreference() calls where we really *do* want the default value to be undefined by passing it explicitly. Also: add TODOs for unused Session arg in JS code hints.
1 parent 23a3e91 commit ba1427c

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/extensibility/Package.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ define(function (require, exports, module) {
4141
NodeConnection = require("utils/NodeConnection"),
4242
PreferencesManager = require("preferences/PreferencesManager");
4343

44-
PreferencesManager.definePreference("proxy", "string");
44+
PreferencesManager.definePreference("proxy", "string", undefined);
4545

4646
var Errors = {
4747
ERROR_LOADING: "ERROR_LOADING",

src/extensions/default/JSLint/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ define(function (require, exports, module) {
5050
*/
5151
var _lastRunOptions;
5252

53-
prefs.definePreference("options", "object")
53+
prefs.definePreference("options", "object", undefined)
5454
.on("change", function (e, data) {
5555
var options = prefs.get("options");
5656
if (!_.isEqual(options, _lastRunOptions)) {

src/extensions/default/JavaScriptCodeHints/ScopeManager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@ define(function (require, exports, module) {
10361036
/**
10371037
* Do the work to initialize a code hinting session.
10381038
*
1039-
* @param {Session} session - the active hinting session
1039+
* @param {Session} session - the active hinting session (TODO: currently unused)
10401040
* @param {!Document} document - the document the editor has changed to
10411041
* @param {?Document} previousDocument - the document the editor has changed from
10421042
*/
@@ -1136,7 +1136,7 @@ define(function (require, exports, module) {
11361136
/**
11371137
* Called each time a new editor becomes active.
11381138
*
1139-
* @param {Session} session - the active hinting session
1139+
* @param {Session} session - the active hinting session (TODO: currently unused by doEditorChange())
11401140
* @param {!Document} document - the document of the editor that has changed
11411141
* @param {?Document} previousDocument - the document of the editor is changing from
11421142
*/

src/language/LanguageManager.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ define(function (require, exports, module) {
10061006
* }
10071007
*/
10081008
function _updateFromPrefs(pref) {
1009-
var newMapping = PreferencesManager.get(pref) || {},
1009+
var newMapping = PreferencesManager.get(pref),
10101010
newNames = Object.keys(newMapping),
10111011
state = _prefState[pref],
10121012
last = state.last,
@@ -1103,14 +1103,14 @@ define(function (require, exports, module) {
11031103
// depends on FileUtils) here. Using the async form of require fixes this.
11041104
require(["preferences/PreferencesManager"], function (pm) {
11051105
PreferencesManager = pm;
1106-
_updateFromPrefs(_EXTENSION_MAP_PREF);
1107-
_updateFromPrefs(_NAME_MAP_PREF);
1108-
pm.definePreference(_EXTENSION_MAP_PREF, "object").on("change", function () {
1106+
pm.definePreference(_EXTENSION_MAP_PREF, "object", {}).on("change", function () {
11091107
_updateFromPrefs(_EXTENSION_MAP_PREF);
11101108
});
1111-
pm.definePreference(_NAME_MAP_PREF, "object").on("change", function () {
1109+
pm.definePreference(_NAME_MAP_PREF, "object", {}).on("change", function () {
11121110
_updateFromPrefs(_NAME_MAP_PREF);
11131111
});
1112+
_updateFromPrefs(_EXTENSION_MAP_PREF);
1113+
_updateFromPrefs(_NAME_MAP_PREF);
11141114
});
11151115
});
11161116

0 commit comments

Comments
 (0)