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

Commit

Permalink
Updated comments
Browse files Browse the repository at this point in the history
  • Loading branch information
WebsiteDeveloper committed Mar 29, 2013
1 parent 04d63b1 commit 7a112d7
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/editor/CodeHintManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
*
* The CodeHintManager mediates the interaction between the editor and a
* collection of hint providers. If hints are requested explicitly by the
* user, then the providers registered for the current mode are queried
* user, then the providers registered for the current language are queried
* for their ability to provide hints in order of descending priority by
* way their hasHints methods. Character insertions may also constitute an
* implicit request for hints; consequently, providers for the current
* mode are also queried on character insertion for both their ability to
* language are also queried on character insertion for both their ability to
* provide hints and also for the suitability of providing implicit hints
* in the given editor context.
*
Expand Down Expand Up @@ -277,38 +277,38 @@ define(function (require, exports, module) {
}

if (registerForAllLanguages) {
// if we're registering in all, then we ignore the modeNames array
// if we're registering in all, then we ignore the languageIdNames array
// so that we avoid registering a provider twice
var languageName;
for (languageName in hintProviders) {
if (hintProviders.hasOwnProperty(languageName)) {
hintProviders[languageName].push(providerObj);
hintProviders[languageName].sort(_providerSort);
var languageId;
for (languageId in hintProviders) {
if (hintProviders.hasOwnProperty(languageId)) {
hintProviders[languageId].push(providerObj);
hintProviders[languageId].sort(_providerSort);
}
}
} else {
languageIdNames.forEach(function (languageName) {
if (languageName) {
if (!hintProviders[languageName]) {
// initialize a new mode with all providers
hintProviders[languageName] = Array.prototype.concat(hintProviders.all);
languageIdNames.forEach(function (languageId) {
if (languageId) {
if (!hintProviders[languageId]) {
// initialize a new language id with all providers
hintProviders[languageId] = Array.prototype.concat(hintProviders.all);
}
hintProviders[languageName].push(providerObj);
hintProviders[languageName].sort(_providerSort);
hintProviders[languageId].push(providerObj);
hintProviders[languageId].sort(_providerSort);
}
});
}
}
}

/**
* Return the array of hint providers for the given mode.
* Return the array of hint providers for the given language id.
* This gets called (potentially) on every keypress. So, it should be fast.
*
* @param {(string|Object<name: string>)} mode
* @return {Array.<{provider: Object, modes: Array.<string>, priority: number}>}
* @param {(string|Object<name: string>)} languageID
* @return {Array.<{provider: Object, languageIDs: Array.<string>, priority: number}>}
*/
function _getProvidersForLanguage(languageID) {
function _getProvidersForLanguageID(languageID) {
return hintProviders[languageID] || hintProviders.all;
}

Expand Down Expand Up @@ -395,7 +395,7 @@ define(function (require, exports, module) {
function _beginSession(editor) {
// Find a suitable provider, if any
var language = editor.getLanguageForSelection(),
enabledProviders = _getProvidersForLanguage(language.getId());
enabledProviders = _getProvidersForLanguageID(language.getId());

$.each(enabledProviders, function (index, item) {
if (item.provider.hasHints(editor, lastChar)) {
Expand Down

0 comments on commit 7a112d7

Please sign in to comment.