From c2347c4898675b19e261a5fbf6e9229cf32b5d60 Mon Sep 17 00:00:00 2001 From: RaymondLim Date: Mon, 3 Dec 2012 22:21:46 -0800 Subject: [PATCH 1/6] Implement registerHintProvider api with extra parameters suggested by Glenn. This change also makes the problematic shouldShowHintsOnKey api no longer needed. It also resolves the conflicts between two or more providers by allowing each provider to register its specificity. --- src/editor/CodeHintManager.js | 118 ++++++++++++++----- src/extensions/default/HTMLCodeHints/main.js | 22 +--- 2 files changed, 93 insertions(+), 47 deletions(-) diff --git a/src/editor/CodeHintManager.js b/src/editor/CodeHintManager.js index d672193b19c..edd0413d704 100644 --- a/src/editor/CodeHintManager.js +++ b/src/editor/CodeHintManager.js @@ -38,11 +38,23 @@ define(function (require, exports, module) { KeyEvent = require("utils/KeyEvent"); - var hintProviders = [], + var hintProviders = {}, hintList, - shouldShowHintsOnChange = false, + triggeredKey = null, keyDownEditor; + /** Comparator to sort providers based on their specificity */ + function _providerSort(a, b) { + if (a.specificity === b.specificity) { + return 0; + } + if (a.specificity > b.specificity) { + return -1; + } + if (a.specificity < b.specificity) { + return 1; + } + } /** * @constructor @@ -257,20 +269,47 @@ define(function (require, exports, module) { * @param {Editor} editor */ CodeHintList.prototype.open = function (editor) { - var self = this; - this.editor = editor; + var self = this, + mode = editor.getModeForSelection(), + enabledProviders = []; + mode = (typeof mode === "string") ? mode : mode.name; + enabledProviders = hintProviders[mode]; + this.editor = editor; Menus.closeAll(); + // If we have any providers for "all" mode, then append it to enabled + // porviders list and sort them based on their specificity again. + if (enabledProviders && hintProviders.all) { + enabledProviders = enabledProviders.concat(hintProviders.all); + enabledProviders.sort(_providerSort); + } else if (hintProviders.all) { + enabledProviders = hintProviders.all; + } + + if (!enabledProviders) { + return; + } + this.currentProvider = null; - $.each(hintProviders, function (index, item) { - var query = item.getQueryInfo(self.editor, self.editor.getCursorPos()); + $.each(enabledProviders, function (index, item) { + // If we have a triggered key, then skip all the providers that + // do not want to be invoked by the triggered key. + if (triggeredKey && item.provider.triggeredKeys && + item.provider.triggeredKeys.indexOf(triggeredKey) === -1) { + return true; + } + + var query = item.provider.getQueryInfo(self.editor, self.editor.getCursorPos()); if (query.queryStr !== null) { self.query = query; - self.currentProvider = item; + self.currentProvider = item.provider; return false; } }); + + triggeredKey = null; + if (!this.currentProvider) { return; } @@ -284,7 +323,7 @@ define(function (require, exports, module) { var hintPos = this.calcHintListLocation(); this.$hintMenu.addClass("open") - .css({"left": hintPos.left, "top": hintPos.top}); + .css({"left": hintPos.left, "top": hintPos.top}); this.opened = true; PopUpManager.addPopUp(this.$hintMenu, @@ -311,7 +350,7 @@ define(function (require, exports, module) { this.$hintMenu.remove(); if (hintList === this) { hintList = null; - shouldShowHintsOnChange = false; + triggeredKey = null; keyDownEditor = null; } }; @@ -386,24 +425,29 @@ define(function (require, exports, module) { * @param {KeyboardEvent} event */ function handleKeyEvent(editor, event) { - var provider = null; + var provider = null, + mode; // Check for Control+Space if (event.type === "keydown" && event.keyCode === 32 && event.ctrlKey) { showHint(editor); event.preventDefault(); } else if (event.type === "keypress") { - // Check if any provider wants to show hints on this key. - $.each(hintProviders, function (index, item) { - if (item.shouldShowHintsOnKey(String.fromCharCode(event.charCode))) { - provider = item; - return false; + mode = editor.getModeForSelection(); + mode = (typeof mode === "string") ? mode : mode.name; + + if (hintProviders[mode]) { + // Check if any provider wants to show hints on this key. + $.each(hintProviders[mode], function (index, item) { + if (item.triggerKeys && item.triggerKeys.indexOf(String.fromCharCode(event.charCode)) !== -1) { + triggeredKey = String.fromCharCode(event.charCode); + return false; + } + }); + + if (triggeredKey) { + keyDownEditor = editor; } - }); - - shouldShowHintsOnChange = !!provider; - if (shouldShowHintsOnChange) { - keyDownEditor = editor; } } @@ -417,8 +461,7 @@ define(function (require, exports, module) { * */ function handleChange(editor) { - if (shouldShowHintsOnChange && keyDownEditor === editor) { - shouldShowHintsOnChange = false; + if (triggeredKey && keyDownEditor === editor) { keyDownEditor = null; showHint(editor); } @@ -434,8 +477,7 @@ define(function (require, exports, module) { * * @param {Object.< getQueryInfo: function(editor, cursor), * search: function(string), - * handleSelect: function(string, Editor, cursor), - * shouldShowHintsOnKey: function(string)>} + * handleSelect: function(string, Editor, cursor)>} * * Parameter Details: * - getQueryInfo - examines cursor location of editor and returns an object representing @@ -446,10 +488,32 @@ define(function (require, exports, module) { * - handleSelect - takes a completion string and inserts it into the editor near the cursor * position. It should return true by default to close the hint list, but if the code hint provider * can return false if it wants to keep the hint list open and continue with a updated list. - * - shouldShowHintsOnKey - inspects the char code and returns true if it wants to show code hints on that key. + * + * @param {Array.} modes An array of mode strings in which the provider can show code hints or "all" + * if it can show code hints in any mode. + * @param {!Array.} triggerKeys An array of all the keys that the provider can be triggered to show hints. + * @param {number} specificity A positive number to indicate the priority of the provider. The larger the number, + * the higher priority the provider has. Zero if it has the lowest priority in displaying its code hints. */ - function registerHintProvider(providerInfo) { - hintProviders.push(providerInfo); + function registerHintProvider(providerInfo, modes, triggerKeys, specificity) { + var providerObj = { provider: providerInfo, + triggerKeys: triggerKeys || [], + specificity: specificity || 0 }; + + if (modes) { + modes.forEach(function (mode) { + if (mode) { + if (!hintProviders[mode]) { + hintProviders[mode] = []; + } + hintProviders[mode].push(providerObj); + + if (hintProviders[mode].length > 1) { + hintProviders[mode].sort(_providerSort); + } + } + }); + } } /** diff --git a/src/extensions/default/HTMLCodeHints/main.js b/src/extensions/default/HTMLCodeHints/main.js index e88c229cb03..893fd5e8950 100644 --- a/src/extensions/default/HTMLCodeHints/main.js +++ b/src/extensions/default/HTMLCodeHints/main.js @@ -120,15 +120,6 @@ define(function (require, exports, module) { return true; }; - /** - * Check whether to show hints on a specific key. - * @param {string} key -- the character for the key user just presses. - * @return {boolean} return true/false to indicate whether hinting should be triggered by this key. - */ - TagHints.prototype.shouldShowHintsOnKey = function (key) { - return key === "<"; - }; - /** * @constructor */ @@ -469,19 +460,10 @@ define(function (require, exports, module) { return result; }; - /** - * Check whether to show hints on a specific key. - * @param {string} key -- the character for the key user just presses. - * @return {boolean} return true/false to indicate whether hinting should be triggered by this key. - */ - AttrHints.prototype.shouldShowHintsOnKey = function (key) { - return (key === " " || key === "'" || key === "\"" || key === "="); - }; - var tagHints = new TagHints(); var attrHints = new AttrHints(); - CodeHintManager.registerHintProvider(tagHints); - CodeHintManager.registerHintProvider(attrHints); + CodeHintManager.registerHintProvider(tagHints, ["html"], ["<"], 0); + CodeHintManager.registerHintProvider(attrHints, ["html"], [" ", "'", "\"", "="], 0); // For unit testing exports.tagHintProvider = tagHints; From 676ca722b323764ce0d90234894ff06188805fcc Mon Sep 17 00:00:00 2001 From: RaymondLim Date: Wed, 5 Dec 2012 12:52:59 -0800 Subject: [PATCH 2/6] Putting back shouldShowHintsOnKey api since JS code hinting Ian is working on requires to be called for every keystokes. --- src/editor/CodeHintManager.js | 122 +++++++++++-------- src/extensions/default/HTMLCodeHints/main.js | 22 +++- 2 files changed, 91 insertions(+), 53 deletions(-) diff --git a/src/editor/CodeHintManager.js b/src/editor/CodeHintManager.js index edd0413d704..f1b5e30c3dc 100644 --- a/src/editor/CodeHintManager.js +++ b/src/editor/CodeHintManager.js @@ -39,23 +39,55 @@ define(function (require, exports, module) { var hintProviders = {}, + triggeredHintProviders = [], hintList, - triggeredKey = null, keyDownEditor; /** Comparator to sort providers based on their specificity */ function _providerSort(a, b) { - if (a.specificity === b.specificity) { - return 0; - } - if (a.specificity > b.specificity) { - return -1; + return b.specificity - a.specificity; + } + + /** + * If there is any providers for all modes, then add them to each individual + * mode providers list and re-sort them based on their specificity. + */ + function _mergeAllModeToIndividualMode() { + var allModeProviders = []; + if (hintProviders.all) { + allModeProviders = hintProviders.all; + + // Remove "all" mode list since we don't need it any more after + // merging them to each individual mode provider lists. + delete hintProviders.all; + + $.each(hintProviders, function (key, value) { + if (hintProviders[key]) { + hintProviders[key] = hintProviders[key].concat(allModeProviders); + hintProviders[key].sort(_providerSort); + } + }); } - if (a.specificity < b.specificity) { - return 1; + } + + /** + * Return the array of hint providers for the given mode. + * If this is called for the first time, then we check if any provider wants to show + * hints on all modes. If there is any, then we merge them into each individual + * mode provider list. + * + * @param {string | Object} mode + * @return {!Array.<{provider:Object, modes:Array, specificity: number}>} + */ + function _getEnabledHintProviders(mode) { + if (hintProviders.all) { + _mergeAllModeToIndividualMode(); } + + mode = (typeof mode === "string") ? mode : mode.name; + return hintProviders[mode] || []; } - + /** * @constructor * @@ -161,7 +193,7 @@ define(function (require, exports, module) { /** * Selects the item in the hint list specified by index - * @param {Number} index + * @param {number} index */ CodeHintList.prototype.setSelectedIndex = function (index) { var items = this.$hintMenu.find("li"); @@ -211,7 +243,6 @@ define(function (require, exports, module) { // Up arrow, down arrow and enter key are always handled here if (event.type !== "keypress") { - if (keyCode === KeyEvent.DOM_VK_RETURN || keyCode === KeyEvent.DOM_VK_TAB || keyCode === KeyEvent.DOM_VK_UP || keyCode === KeyEvent.DOM_VK_DOWN || keyCode === KeyEvent.DOM_VK_PAGE_UP || keyCode === KeyEvent.DOM_VK_PAGE_DOWN) { @@ -251,7 +282,7 @@ define(function (require, exports, module) { /** * Return true if the CodeHintList is open. - * @return {Boolean} + * @return {boolean} */ CodeHintList.prototype.isOpen = function () { // We don't get a notification when the dropdown closes. The best @@ -273,33 +304,21 @@ define(function (require, exports, module) { mode = editor.getModeForSelection(), enabledProviders = []; - mode = (typeof mode === "string") ? mode : mode.name; - enabledProviders = hintProviders[mode]; - this.editor = editor; - Menus.closeAll(); - - // If we have any providers for "all" mode, then append it to enabled - // porviders list and sort them based on their specificity again. - if (enabledProviders && hintProviders.all) { - enabledProviders = enabledProviders.concat(hintProviders.all); - enabledProviders.sort(_providerSort); - } else if (hintProviders.all) { - enabledProviders = hintProviders.all; + if (triggeredHintProviders.length > 0) { + enabledProviders = triggeredHintProviders; + } else { + enabledProviders = _getEnabledHintProviders(mode); } - if (!enabledProviders) { + if (enabledProviders.length === 0) { return; } + this.editor = editor; + Menus.closeAll(); + this.currentProvider = null; $.each(enabledProviders, function (index, item) { - // If we have a triggered key, then skip all the providers that - // do not want to be invoked by the triggered key. - if (triggeredKey && item.provider.triggeredKeys && - item.provider.triggeredKeys.indexOf(triggeredKey) === -1) { - return true; - } - var query = item.provider.getQueryInfo(self.editor, self.editor.getCursorPos()); if (query.queryStr !== null) { self.query = query; @@ -308,8 +327,6 @@ define(function (require, exports, module) { } }); - triggeredKey = null; - if (!this.currentProvider) { return; } @@ -350,14 +367,13 @@ define(function (require, exports, module) { this.$hintMenu.remove(); if (hintList === this) { hintList = null; - triggeredKey = null; keyDownEditor = null; } }; /** * Computes top left location for hint list so that the list is not clipped by the window - * @return {Object. } + * @return {Object. } */ CodeHintList.prototype.calcHintListLocation = function () { var cursor = this.editor._codeMirror.cursorCoords(), @@ -425,27 +441,30 @@ define(function (require, exports, module) { * @param {KeyboardEvent} event */ function handleKeyEvent(editor, event) { - var provider = null, - mode; + var mode = editor.getModeForSelection(), + enabledProviders = [], + key; // Check for Control+Space if (event.type === "keydown" && event.keyCode === 32 && event.ctrlKey) { + triggeredHintProviders = []; showHint(editor); event.preventDefault(); } else if (event.type === "keypress") { mode = editor.getModeForSelection(); - mode = (typeof mode === "string") ? mode : mode.name; - - if (hintProviders[mode]) { - // Check if any provider wants to show hints on this key. - $.each(hintProviders[mode], function (index, item) { - if (item.triggerKeys && item.triggerKeys.indexOf(String.fromCharCode(event.charCode)) !== -1) { - triggeredKey = String.fromCharCode(event.charCode); - return false; + enabledProviders = _getEnabledHintProviders(mode); + + triggeredHintProviders = []; + if (enabledProviders.length > 0) { + key = String.fromCharCode(event.charCode); + // Check if any provider wants to start showing hints on this key. + $.each(enabledProviders, function (index, item) { + if (item.provider.shouldShowHintsOnKey(key)) { + triggeredHintProviders.push(item); } }); - if (triggeredKey) { + if (triggeredHintProviders.length > 0) { keyDownEditor = editor; } } @@ -461,7 +480,7 @@ define(function (require, exports, module) { * */ function handleChange(editor) { - if (triggeredKey && keyDownEditor === editor) { + if (triggeredHintProviders.length > 0 && keyDownEditor === editor) { keyDownEditor = null; showHint(editor); } @@ -477,7 +496,8 @@ define(function (require, exports, module) { * * @param {Object.< getQueryInfo: function(editor, cursor), * search: function(string), - * handleSelect: function(string, Editor, cursor)>} + * handleSelect: function(string, Editor, cursor), + * shouldShowHintsOnKey: function(string)>} * * Parameter Details: * - getQueryInfo - examines cursor location of editor and returns an object representing @@ -488,6 +508,7 @@ define(function (require, exports, module) { * - handleSelect - takes a completion string and inserts it into the editor near the cursor * position. It should return true by default to close the hint list, but if the code hint provider * can return false if it wants to keep the hint list open and continue with a updated list. + * - shouldShowHintsOnKey - inspects the char code and returns true if it wants to show code hints on that key. * * @param {Array.} modes An array of mode strings in which the provider can show code hints or "all" * if it can show code hints in any mode. @@ -495,9 +516,8 @@ define(function (require, exports, module) { * @param {number} specificity A positive number to indicate the priority of the provider. The larger the number, * the higher priority the provider has. Zero if it has the lowest priority in displaying its code hints. */ - function registerHintProvider(providerInfo, modes, triggerKeys, specificity) { + function registerHintProvider(providerInfo, modes, specificity) { var providerObj = { provider: providerInfo, - triggerKeys: triggerKeys || [], specificity: specificity || 0 }; if (modes) { diff --git a/src/extensions/default/HTMLCodeHints/main.js b/src/extensions/default/HTMLCodeHints/main.js index 893fd5e8950..b2f5f830ede 100644 --- a/src/extensions/default/HTMLCodeHints/main.js +++ b/src/extensions/default/HTMLCodeHints/main.js @@ -120,6 +120,15 @@ define(function (require, exports, module) { return true; }; + /** + * Check whether to show hints on a specific key. + * @param {string} key -- the character for the key user just presses. + * @return {boolean} return true/false to indicate whether hinting should be triggered by this key. + */ + TagHints.prototype.shouldShowHintsOnKey = function (key) { + return key === "<"; + }; + /** * @constructor */ @@ -460,10 +469,19 @@ define(function (require, exports, module) { return result; }; + /** + * Check whether to show hints on a specific key. + * @param {string} key -- the character for the key user just presses. + * @return {boolean} return true/false to indicate whether hinting should be triggered by this key. + */ + AttrHints.prototype.shouldShowHintsOnKey = function (key) { + return (key === " " || key === "'" || key === "\"" || key === "="); + }; + var tagHints = new TagHints(); var attrHints = new AttrHints(); - CodeHintManager.registerHintProvider(tagHints, ["html"], ["<"], 0); - CodeHintManager.registerHintProvider(attrHints, ["html"], [" ", "'", "\"", "="], 0); + CodeHintManager.registerHintProvider(tagHints, ["html"], 0); + CodeHintManager.registerHintProvider(attrHints, ["html"], 0); // For unit testing exports.tagHintProvider = tagHints; From 53c1d9463fcf9d151618e97938930ff74c671039 Mon Sep 17 00:00:00 2001 From: RaymondLim Date: Wed, 5 Dec 2012 18:19:37 -0800 Subject: [PATCH 3/6] Correct some mistakes in jsDoc. --- src/editor/CodeHintManager.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/editor/CodeHintManager.js b/src/editor/CodeHintManager.js index f1b5e30c3dc..2ee325c4155 100644 --- a/src/editor/CodeHintManager.js +++ b/src/editor/CodeHintManager.js @@ -49,7 +49,7 @@ define(function (require, exports, module) { } /** - * If there is any providers for all modes, then add them to each individual + * If there is any provider for all modes, then add it to each individual * mode providers list and re-sort them based on their specificity. */ function _mergeAllModeToIndividualMode() { @@ -73,11 +73,11 @@ define(function (require, exports, module) { /** * Return the array of hint providers for the given mode. * If this is called for the first time, then we check if any provider wants to show - * hints on all modes. If there is any, then we merge them into each individual + * hints on all modes. If there is any, then we merge it into each individual * mode provider list. * - * @param {string | Object} mode - * @return {!Array.<{provider:Object, modes:Array, specificity: number}>} + * @param {(string|Object)} mode + * @return {Array.<{provider: Object, modes: Array., specificity: number}>} */ function _getEnabledHintProviders(mode) { if (hintProviders.all) { @@ -512,7 +512,6 @@ define(function (require, exports, module) { * * @param {Array.} modes An array of mode strings in which the provider can show code hints or "all" * if it can show code hints in any mode. - * @param {!Array.} triggerKeys An array of all the keys that the provider can be triggered to show hints. * @param {number} specificity A positive number to indicate the priority of the provider. The larger the number, * the higher priority the provider has. Zero if it has the lowest priority in displaying its code hints. */ From ea97d4ed06b23162d860fab81b37d2f8660c961c Mon Sep 17 00:00:00 2001 From: RaymondLim Date: Wed, 5 Dec 2012 22:13:19 -0800 Subject: [PATCH 4/6] Add one more code hints extension api to let the provider decide on the default initial selection. This fixes issue #2286 --- src/editor/CodeHintManager.js | 13 +++++++++++-- src/extensions/default/HTMLCodeHints/main.js | 16 ++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/editor/CodeHintManager.js b/src/editor/CodeHintManager.js index 2ee325c4155..499715a1bb0 100644 --- a/src/editor/CodeHintManager.js +++ b/src/editor/CodeHintManager.js @@ -184,7 +184,7 @@ define(function (require, exports, module) { if (count === 0) { this.close(); - } else { + } else if (this.currentProvider.wantInitialSelection()) { // Select the first item in the list this.setSelectedIndex(0); } @@ -243,6 +243,13 @@ define(function (require, exports, module) { // Up arrow, down arrow and enter key are always handled here if (event.type !== "keypress") { + // If we don't have a selection in the list, then just update the list and + // show it at the new location for Return and Tab keys. + if (this.selectedIndex === -1 && (keyCode === KeyEvent.DOM_VK_RETURN || keyCode === KeyEvent.DOM_VK_TAB)) { + this.updateQueryAndList(); + return; + } + if (keyCode === KeyEvent.DOM_VK_RETURN || keyCode === KeyEvent.DOM_VK_TAB || keyCode === KeyEvent.DOM_VK_UP || keyCode === KeyEvent.DOM_VK_DOWN || keyCode === KeyEvent.DOM_VK_PAGE_UP || keyCode === KeyEvent.DOM_VK_PAGE_DOWN) { @@ -497,7 +504,8 @@ define(function (require, exports, module) { * @param {Object.< getQueryInfo: function(editor, cursor), * search: function(string), * handleSelect: function(string, Editor, cursor), - * shouldShowHintsOnKey: function(string)>} + * shouldShowHintsOnKey: function(string), + * wantInitialSelection: function()>} * * Parameter Details: * - getQueryInfo - examines cursor location of editor and returns an object representing @@ -509,6 +517,7 @@ define(function (require, exports, module) { * position. It should return true by default to close the hint list, but if the code hint provider * can return false if it wants to keep the hint list open and continue with a updated list. * - shouldShowHintsOnKey - inspects the char code and returns true if it wants to show code hints on that key. + * - wantInitialSelection - return true if the provider wants to select the first hint item by default. * * @param {Array.} modes An array of mode strings in which the provider can show code hints or "all" * if it can show code hints in any mode. diff --git a/src/extensions/default/HTMLCodeHints/main.js b/src/extensions/default/HTMLCodeHints/main.js index b2f5f830ede..6deb1d659f1 100644 --- a/src/extensions/default/HTMLCodeHints/main.js +++ b/src/extensions/default/HTMLCodeHints/main.js @@ -129,6 +129,14 @@ define(function (require, exports, module) { return key === "<"; }; + /** + * Check whether to select the first item in the list by default + * @return {boolean} return true to highlight the first item. + */ + TagHints.prototype.wantInitialSelection = function () { + return true; + }; + /** * @constructor */ @@ -478,6 +486,14 @@ define(function (require, exports, module) { return (key === " " || key === "'" || key === "\"" || key === "="); }; + /** + * Check whether to select the first item in the list by default + * @return {boolean} return true to highlight the first item. + */ + AttrHints.prototype.wantInitialSelection = function () { + return true; + }; + var tagHints = new TagHints(); var attrHints = new AttrHints(); CodeHintManager.registerHintProvider(tagHints, ["html"], 0); From c099f5e7041ddbd99f9912431a21f501521282ae Mon Sep 17 00:00:00 2001 From: RaymondLim Date: Thu, 6 Dec 2012 13:22:14 -0800 Subject: [PATCH 5/6] Use a local variable to avoid modifying the parameter. --- src/editor/CodeHintManager.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/editor/CodeHintManager.js b/src/editor/CodeHintManager.js index 499715a1bb0..30404bef8ea 100644 --- a/src/editor/CodeHintManager.js +++ b/src/editor/CodeHintManager.js @@ -84,8 +84,8 @@ define(function (require, exports, module) { _mergeAllModeToIndividualMode(); } - mode = (typeof mode === "string") ? mode : mode.name; - return hintProviders[mode] || []; + var modeStr = (typeof mode === "string") ? mode : mode.name; + return hintProviders[modeStr] || []; } /** From ba32cb5c85953cd1e5d5b25700147f23f27af34c Mon Sep 17 00:00:00 2001 From: RaymondLim Date: Thu, 6 Dec 2012 13:45:42 -0800 Subject: [PATCH 6/6] modeName sounds better. --- src/editor/CodeHintManager.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/editor/CodeHintManager.js b/src/editor/CodeHintManager.js index 30404bef8ea..7605dbbb0af 100644 --- a/src/editor/CodeHintManager.js +++ b/src/editor/CodeHintManager.js @@ -84,8 +84,8 @@ define(function (require, exports, module) { _mergeAllModeToIndividualMode(); } - var modeStr = (typeof mode === "string") ? mode : mode.name; - return hintProviders[modeStr] || []; + var modeName = (typeof mode === "string") ? mode : mode.name; + return hintProviders[modeName] || []; } /**