From 6e3dba52e5fc9cddb059756c09e5ee99527add55 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Tue, 26 Jan 2016 16:35:58 +0000 Subject: [PATCH] Set up feature flag for references autocomplete. --- .../auto-complete/AutoCompleteManager.coffee | 16 +++++++------- .../ReferencesSearchManager.coffee | 21 ++++--------------- 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.coffee index da12f5f17f..51a2220226 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.coffee @@ -72,13 +72,15 @@ define [ result.push(referenceKeyToAutocompleteEntry(key)) callback null, result else - # get keys from the backend - referencesSearch = window?._ide?.referencesSearchManager - if referencesSearch - referencesSearch.getReferenceKeys (keys) => - keys.forEach (key) -> - result.push(referenceKeyToAutocompleteEntry(key)) - callback null, result + callback null, result + # else + # # get keys from the backend + # referencesSearch = window?._ide?.referencesSearchManager + # if referencesSearch + # referencesSearch.getReferenceKeys (keys) => + # keys.forEach (key) -> + # result.push(referenceKeyToAutocompleteEntry(key)) + # callback null, result @editor.completers = [@suggestionManager, SnippetCompleter, ReferencesCompleter] diff --git a/services/web/public/coffee/ide/references-search/ReferencesSearchManager.coffee b/services/web/public/coffee/ide/references-search/ReferencesSearchManager.coffee index 26f338603f..f8e5529783 100644 --- a/services/web/public/coffee/ide/references-search/ReferencesSearchManager.coffee +++ b/services/web/public/coffee/ide/references-search/ReferencesSearchManager.coffee @@ -24,12 +24,13 @@ define [ ) _storeReferencesKeys: (newKeys) -> + if window._ENABLE_REFERENCES_AUTOCOMPLETE != true + return + console.log '>> storing references keys' @$scope.$root._references.keys = newKeys # docIds: List[String]|String('ALL'), shouldBroadcast: Bool indexReferences: (docIds, shouldBroadcast) -> - if window._ENABLE_REFERENCES_AUTOCOMPLETE != true - return opts = docIds: docIds shouldBroadcast: shouldBroadcast @@ -38,20 +39,6 @@ define [ "/project/#{@$scope.project_id}/references/index", opts, (data) => - console.log ">> done ", data + console.log ">> got keys ", data @_storeReferencesKeys(data.keys) ) - - getReferenceKeys: (callback=(keys)->) -> - if window._ENABLE_REFERENCES_AUTOCOMPLETE != true - return - $.get( - "/project/#{@$scope.project_id}/references/keys", - { - _csrf: window.csrfToken - }, - (data) => - @_storeReferencesKeys(data.keys) - if callback - callback(data.keys) - )