225225 * or if instead a tab character should be inserted into the editor. If omitted,
226226 * the fallback behavior is determined by the CodeHintManager. The default
227227 * behavior is to insert a tab character, but this can be changed with the
228- * CodeHintManager.setInsertHintOnTab() method .
228+ * insertHintOnTab Preference .
229229 */
230230
231231
@@ -236,12 +236,13 @@ define(function (require, exports, module) {
236236 "use strict" ;
237237
238238 // Load dependent modules
239- var Commands = require ( "command/Commands" ) ,
240- CommandManager = require ( "command/CommandManager" ) ,
241- EditorManager = require ( "editor/EditorManager" ) ,
242- Strings = require ( "strings" ) ,
243- KeyEvent = require ( "utils/KeyEvent" ) ,
244- CodeHintList = require ( "editor/CodeHintList" ) . CodeHintList ;
239+ var Commands = require ( "command/Commands" ) ,
240+ CommandManager = require ( "command/CommandManager" ) ,
241+ EditorManager = require ( "editor/EditorManager" ) ,
242+ Strings = require ( "strings" ) ,
243+ KeyEvent = require ( "utils/KeyEvent" ) ,
244+ CodeHintList = require ( "editor/CodeHintList" ) . CodeHintList ,
245+ PreferencesManager = require ( "preferences/PreferencesManager" ) ;
245246
246247 var hintProviders = { "all" : [ ] } ,
247248 lastChar = null ,
@@ -250,24 +251,11 @@ define(function (require, exports, module) {
250251 hintList = null ,
251252 deferredHints = null ,
252253 keyDownEditor = null ;
253-
254254
255- var _insertHintOnTabDefault = false ;
256-
257- /**
258- * Determines the default behavior of the CodeHintManager on tab key events.
259- * setInsertHintOnTab(true) indicates that the currently selected code hint
260- * should be inserted on tab key events. setInsertHintOnTab(false) indicates
261- * that a tab character should be inserted into the editor on tab key events.
262- * The default behavior can be overridden by individual providers.
263- *
264- * @param {boolean } Indicates whether providers should insert the currently
265- * selected hint on tab key events.
266- */
267- function setInsertHintOnTab ( insertHintOnTab ) {
268- _insertHintOnTabDefault = insertHintOnTab ;
269- }
270255
256+ PreferencesManager . definePreference ( "insertHintOnTab" , "boolean" , false ) ;
257+
258+
271259 /**
272260 * Comparator to sort providers from high to low priority
273261 */
@@ -474,7 +462,7 @@ define(function (require, exports, module) {
474462 if ( sessionProvider . insertHintOnTab !== undefined ) {
475463 insertHintOnTab = sessionProvider . insertHintOnTab ;
476464 } else {
477- insertHintOnTab = _insertHintOnTabDefault ;
465+ insertHintOnTab = PreferencesManager . get ( "insertHintOnTab" ) ;
478466 }
479467
480468 sessionEditor = editor ;
@@ -665,5 +653,4 @@ define(function (require, exports, module) {
665653 exports . isOpen = isOpen ;
666654 exports . registerHintProvider = registerHintProvider ;
667655 exports . hasValidExclusion = hasValidExclusion ;
668- exports . setInsertHintOnTab = setInsertHintOnTab ;
669656} ) ;
0 commit comments