def ComputeCandidates(self, request_data): if (not ForceSemanticCompletion(request_data) and not self.ShouldUseNow(request_data)): return [] candidates = self._GetCandidatesFromSubclass(request_data) return self.FilterAndSortCandidates(candidates, request_data['query'])
def ShouldUseFiletypeCompleter( self, request_data ): """ Determines whether or not the semantic completer should be called, and returns an indication of the reason why. Specifically, returns a tuple: ( should_use_completer_now, was_semantic_completion_forced ), where: - should_use_completer_now: if True, the semantic engine should be used - was_semantic_completion_forced: if True, the user requested "forced" semantic completion was_semantic_completion_forced is always False if should_use_completer_now is False """ filetypes = request_data[ 'filetypes' ] if self.FiletypeCompletionUsable( filetypes ): if ForceSemanticCompletion( request_data ): # use semantic, and it was forced return ( True, True ) else: # was not forced. check the conditions for triggering return ( self.GetFiletypeCompleter( filetypes ).ShouldUseNow( request_data ), False ) # don't use semantic, ignore whether or not the user requested forced # completion return ( False, False )
def ShouldUseFiletypeCompleter( self, request_data ): filetypes = request_data[ 'filetypes' ] if self.FiletypeCompletionUsable( filetypes ): return ( ForceSemanticCompletion( request_data ) or self.GetFiletypeCompleter( filetypes ).ShouldUseNow( request_data ) ) return False
def CompletionType(self, request_data): return ForceSemanticCompletion(request_data)