Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
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
37 changes: 12 additions & 25 deletions src/editor/CodeHintManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
* or if instead a tab character should be inserted into the editor. If omitted,
* the fallback behavior is determined by the CodeHintManager. The default
* behavior is to insert a tab character, but this can be changed with the
* CodeHintManager.setInsertHintOnTab() method.
* insertHintOnTab Preference.
*/


Expand All @@ -236,12 +236,13 @@ define(function (require, exports, module) {
"use strict";

// Load dependent modules
var Commands = require("command/Commands"),
CommandManager = require("command/CommandManager"),
EditorManager = require("editor/EditorManager"),
Strings = require("strings"),
KeyEvent = require("utils/KeyEvent"),
CodeHintList = require("editor/CodeHintList").CodeHintList;
var Commands = require("command/Commands"),
CommandManager = require("command/CommandManager"),
EditorManager = require("editor/EditorManager"),
Strings = require("strings"),
KeyEvent = require("utils/KeyEvent"),
CodeHintList = require("editor/CodeHintList").CodeHintList,
PreferencesManager = require("preferences/PreferencesManager");

var hintProviders = { "all" : [] },
lastChar = null,
Expand All @@ -250,24 +251,11 @@ define(function (require, exports, module) {
hintList = null,
deferredHints = null,
keyDownEditor = null;


var _insertHintOnTabDefault = false;

/**
* Determines the default behavior of the CodeHintManager on tab key events.
* setInsertHintOnTab(true) indicates that the currently selected code hint
* should be inserted on tab key events. setInsertHintOnTab(false) indicates
* that a tab character should be inserted into the editor on tab key events.
* The default behavior can be overridden by individual providers.
*
* @param {boolean} Indicates whether providers should insert the currently
* selected hint on tab key events.
*/
function setInsertHintOnTab(insertHintOnTab) {
_insertHintOnTabDefault = insertHintOnTab;
}

PreferencesManager.definePreference("insertHintOnTab", "boolean", false);


/**
* Comparator to sort providers from high to low priority
*/
Expand Down Expand Up @@ -474,7 +462,7 @@ define(function (require, exports, module) {
if (sessionProvider.insertHintOnTab !== undefined) {
insertHintOnTab = sessionProvider.insertHintOnTab;
} else {
insertHintOnTab = _insertHintOnTabDefault;
insertHintOnTab = PreferencesManager.get("insertHintOnTab");
}

sessionEditor = editor;
Expand Down Expand Up @@ -655,5 +643,4 @@ define(function (require, exports, module) {
exports.isOpen = isOpen;
exports.registerHintProvider = registerHintProvider;
exports.hasValidExclusion = hasValidExclusion;
exports.setInsertHintOnTab = setInsertHintOnTab;
});
1 change: 0 additions & 1 deletion src/language/CodeInspection.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,6 @@ define(function (require, exports, module) {
updateListeners();
if (!doNotSave) {
prefs.set(PREF_ENABLED, _enabled);
prefs.save();
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I noticed that this isn't needed anymore with the latest API change.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice catch on this.


// run immediately
Expand Down