def test_request_completions(self): listener = StackIDEAutocompleteHandler() (window, view) = default_mock_window() view.settings().get = Mock(return_value=False) backend = setup_mock_backend(window) listener.on_query_completions(view, 'm', []) #locations not used. req = Req.get_autocompletion(filepath=util.relative_view_file_name(view),prefix="m") req['seq'] = ANY backend.send_request.assert_called_with(req)
def on_query_completions(self, view, prefix, locations): if not is_haskell_view(view): return window = view.window() if not StackIDEManager.is_running(window): return # Check if this completion query is due to our refreshing the completions list # after receiving a response from stack-ide, and if so, don't send # another request for completions. if not self.refreshing: self.view = view request = Req.get_autocompletion(filepath=relative_view_file_name(view),prefix=prefix) send_request(window, request, self._handle_response) # Clear the flag to allow future completion queries self.refreshing = False return list(self.format_completion(*completion) for completion in self.returned_completions)
def on_query_completions(self, view, prefix, locations): if not is_haskell_view(view): return window = view.window() if not StackIDEManager.is_running(window): return # Check if this completion query is due to our refreshing the completions list # after receiving a response from stack-ide, and if so, don't send # another request for completions. if not self.refreshing: self.view = view request = Req.get_autocompletion( filepath=relative_view_file_name(view), prefix=prefix) send_request(window, request, self._handle_response) # Clear the flag to allow future completion queries self.refreshing = False return list( self.format_completion(*completion) for completion in self.returned_completions)