Преглед изворни кода

Set up feature flag for references autocomplete.

Shane Kilkelly пре 10 година
родитељ
комит
6e3dba52e5

+ 9 - 7
services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.coffee

@@ -72,13 +72,15 @@ define [
 								result.push(referenceKeyToAutocompleteEntry(key))
 								result.push(referenceKeyToAutocompleteEntry(key))
 							callback null, result
 							callback null, result
 						else
 						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]
 			@editor.completers = [@suggestionManager, SnippetCompleter, ReferencesCompleter]
 
 

+ 4 - 17
services/web/public/coffee/ide/references-search/ReferencesSearchManager.coffee

@@ -24,12 +24,13 @@ define [
 			)
 			)
 
 
 		_storeReferencesKeys: (newKeys) ->
 		_storeReferencesKeys: (newKeys) ->
+			if window._ENABLE_REFERENCES_AUTOCOMPLETE != true
+				return
+			console.log '>> storing references keys'
 			@$scope.$root._references.keys = newKeys
 			@$scope.$root._references.keys = newKeys
 
 
 		# docIds: List[String]|String('ALL'), shouldBroadcast: Bool
 		# docIds: List[String]|String('ALL'), shouldBroadcast: Bool
 		indexReferences: (docIds, shouldBroadcast) ->
 		indexReferences: (docIds, shouldBroadcast) ->
-			if window._ENABLE_REFERENCES_AUTOCOMPLETE != true
-				return
 			opts =
 			opts =
 				docIds: docIds
 				docIds: docIds
 				shouldBroadcast: shouldBroadcast
 				shouldBroadcast: shouldBroadcast
@@ -38,20 +39,6 @@ define [
 				"/project/#{@$scope.project_id}/references/index",
 				"/project/#{@$scope.project_id}/references/index",
 				opts,
 				opts,
 				(data) =>
 				(data) =>
-					console.log ">> done ", 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) =>
+					console.log ">> got keys ", data
 					@_storeReferencesKeys(data.keys)
 					@_storeReferencesKeys(data.keys)
-					if callback
-						callback(data.keys)
 			)
 			)