def Response(self): if not self._response_future: return [] try: return _ConvertCompletionResponseToVimDatas( JsonFromFuture(self._response_future)) except Exception as e: HandleServerException(e) return []
def ShowDetailedDiagnostic(self): if not self.IsServerAlive(): return with HandleServerException(): detailed_diagnostic = BaseRequest.PostDataToHandler( BuildRequestData(), 'detailed_diagnostic') if 'message' in detailed_diagnostic: vimsupport.PostVimMessage(detailed_diagnostic['message'], warning=False)
def Response( self ): if self._cached_response: return self._cached_response if not self._response_future or self._event_name != 'FileReadyToParse': return [] with HandleServerException( truncate = True ): self._cached_response = JsonFromFuture( self._response_future ) return self._cached_response if self._cached_response else []
def FilterAndSortCandidatesInner(self, candidates, sort_property, query): request_data = { 'candidates': candidates, 'sort_property': sort_property, 'query': query } with HandleServerException(): return BaseRequest.PostDataToHandler(request_data, 'filter_and_sort_candidates') return candidates
def Start(self): request_data = BuildRequestData() request_data.update({ 'completer_target': self._completer_target, 'command_arguments': self._arguments }) try: self._response = self.PostDataToHandler(request_data, 'run_completer_command') except (ServerError, ReadTimeout) as e: HandleServerException(e)
def Start(self): request_data = BuildRequestData() if self._extra_data: request_data.update(self._extra_data) request_data.update({ 'completer_target': self._completer_target, 'command_arguments': self._arguments }) with HandleServerException(): self._response = self.PostDataToHandler(request_data, 'run_completer_command')
def Response(self): if self._cached_response: return self._cached_response if not self._response_future or self._event_name != 'FileReadyToParse': return [] try: try: self._cached_response = JsonFromFuture(self._response_future) except UnknownExtraConf as e: if vimsupport.Confirm(str(e)): _LoadExtraConfFile(e.extra_conf_file) else: _IgnoreExtraConfFile(e.extra_conf_file) except Exception as e: HandleServerException(e) return self._cached_response if self._cached_response else []
def Poll(self, diagnostics_handler): """This should be called regularly to check for new messages in this buffer. Returns True if Poll should be called again in a while. Returns False when the completer or server indicated that further polling should not be done for the requested file.""" if self._response_future is None: # First poll self._SendRequest() return True if not self._response_future.done(): # Nothing yet... return True with HandleServerException(display=False): response = JsonFromFuture(self._response_future) poll_again = _HandlePollResponse(response, diagnostics_handler) if poll_again: self._SendRequest() return True return False
def GetDefinedSubcommands(self): with HandleServerException(): return BaseRequest.PostDataToHandler(BuildRequestData(), 'defined_subcommands') return []
def CheckIfServerIsReady(self): if not self._server_is_ready_with_cache and self.IsServerAlive(): with HandleServerException(display=False): self._server_is_ready_with_cache = BaseRequest.GetDataFromHandler( 'ready') return self._server_is_ready_with_cache
def _ThreadMain(self): while True: time.sleep(self._ping_interval_seconds) with HandleServerException(display=False): BaseRequest.GetDataFromHandler('healthy')
def Start(self): request_data = BuildRequestData() with HandleServerException(display=False): self._response = self.PostDataToHandler(request_data, 'debug_info')
def Start(self): request_data = BuildRequestData() request_data.update({'filetypes': self.filetypes}) with HandleServerException(): self._response = self.PostDataToHandler( request_data, 'semantic_completion_available')
def Start(self): with HandleServerException(display=False): self.PostDataToHandler({}, 'shutdown', TIMEOUT_SECONDS)