예제 #1
0
 def ServerBecomesReady( self ):
   if not self._server_is_ready_with_cache:
     with HandleServerException( display = False ):
       self._server_is_ready_with_cache = BaseRequest.GetDataFromHandler(
           'ready' )
     return self._server_is_ready_with_cache
   return False
예제 #2
0
  def ShowDetailedDiagnostic( self ):
    detailed_diagnostic = BaseRequest().PostDataToHandler(
        BuildRequestData(), 'detailed_diagnostic' )

    if detailed_diagnostic and 'message' in detailed_diagnostic:
      vimsupport.PostVimMessage( detailed_diagnostic[ 'message' ],
                                 warning = False )
예제 #3
0
    def ShowDetailedDiagnostic(self):
        with HandleServerException():
            detailed_diagnostic = BaseRequest.PostDataToHandler(
                BuildRequestData(), 'detailed_diagnostic')

            if 'message' in detailed_diagnostic:
                vimsupport.PostVimMessage(detailed_diagnostic['message'],
                                          warning=False)
예제 #4
0
 def FilterAndSortItems(self, items, sort_property, query, max_items=0):
     return BaseRequest().PostDataToHandler(
         {
             'candidates': items,
             'sort_property': sort_property,
             'max_num_candidates': max_items,
             'query': vimsupport.ToUnicode(query)
         }, 'filter_and_sort_candidates')
예제 #5
0
 def GetDefinedSubcommands(self):
     if self.IsServerAlive():
         try:
             return BaseRequest.PostDataToHandler(BuildRequestData(),
                                                  'defined_subcommands')
         except ServerError:
             return []
     else:
         return []
예제 #6
0
 def ShowDetailedDiagnostic(self):
     if not self.IsServerAlive():
         return
     try:
         debug_info = BaseRequest.PostDataToHandler(BuildRequestData(),
                                                    'detailed_diagnostic')
         if 'message' in debug_info:
             vimsupport.EchoText(debug_info['message'])
     except ServerError as e:
         vimsupport.PostVimMessage(str(e))
예제 #7
0
    def _ThreadMain(self):
        while True:
            time.sleep(self._ping_interval_seconds)

            # We don't care if there's an intermittent problem in contacting the
            # server; it's fine to just skip this ping.
            try:
                BaseRequest.GetDataFromHandler('healthy')
            except:
                pass
예제 #8
0
    def FilterAndSortCandidatesInner(self, candidates, sort_property, query):
        request_data = {
            'candidates': candidates,
            'sort_property': sort_property,
            'query': query
        }

        response = BaseRequest().PostDataToHandler(
            request_data, 'filter_and_sort_candidates')
        return response if response is not None else []
예제 #9
0
    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
예제 #10
0
    def DebugInfo(self):
        if self.IsServerAlive():
            debug_info = BaseRequest.PostDataToHandler(BuildRequestData(),
                                                       'debug_info')
        else:
            debug_info = 'Server crashed, no debug info from server'
        debug_info += '\nServer running at: {0}'.format(
            BaseRequest.server_location)
        debug_info += '\nServer process ID: {0}'.format(self._server_popen.pid)
        if self._server_stderr or self._server_stdout:
            debug_info += '\nServer logfiles:\n  {0}\n  {1}'.format(
                self._server_stdout, self._server_stderr)

        return debug_info
예제 #11
0
  def ShowDetailedDiagnostic( self, message_in_popup ):
    detailed_diagnostic = BaseRequest().PostDataToHandler(
        BuildRequestData(), 'detailed_diagnostic' )
    if detailed_diagnostic and 'message' in detailed_diagnostic:
      message = detailed_diagnostic[ 'message' ]
      if message_in_popup and vimsupport.VimSupportsPopupWindows():
        window = vim.current.window
        buffer_number = vimsupport.GetCurrentBufferNumber()
        diags_on_this_line = self._buffers[ buffer_number ].DiagnosticsForLine(
            window.cursor[ 0 ] )

        lines = message.split( '\n' )
        available_columns = vimsupport.GetIntValue( '&columns' )
        col = window.cursor[ 1 ] + 1
        if col > available_columns - 2: # -2 accounts for padding.
          col = 0
        options = {
          'col': col,
          'padding': [ 0, 1, 0, 1 ],
          'maxwidth': available_columns,
          'close': 'click',
          'fixed': 0,
          'highlight': 'ErrorMsg',
          'border': [ 1, 1, 1, 1 ],
          # Close when moving cursor
          'moved': 'expr',
        }
        popup_func = 'popup_atcursor'
        for diag in diags_on_this_line:
          if message == diag[ 'text' ]:
            popup_func = 'popup_create'
            prop = vimsupport.GetTextPropertyForDiag( buffer_number,
                                                      window.cursor[ 0 ],
                                                      diag )
            options.update( {
              'textpropid': prop[ 'id' ],
              'textprop': prop[ 'type' ],
            } )
            options.pop( 'col' )
        vim.eval( f'{ popup_func }( { lines }, { options } )' )
      else:
        vimsupport.PostVimMessage( message, warning = False )
예제 #12
0
 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
예제 #13
0
def _IgnoreExtraConfFile(filepath):
    BaseRequest.PostDataToHandler({'filepath': filepath},
                                  'ignore_extra_conf_file')
예제 #14
0
파일: __init__.py 프로젝트: zimingzpp/rc
def _IsReady():
  return BaseRequest().GetDataFromHandler( 'ready' )
예제 #15
0
 def GetDefinedSubcommands( self ):
   subcommands = BaseRequest().PostDataToHandler( BuildRequestData(),
                                                  'defined_subcommands' )
   return subcommands if subcommands else []
예제 #16
0
 def CheckIfServerIsReady( self ):
   if not self._server_is_ready_with_cache and self.IsServerAlive():
     self._server_is_ready_with_cache = BaseRequest().GetDataFromHandler(
         'ready', display_message = False )
   return self._server_is_ready_with_cache
예제 #17
0
 def GetDefinedSubcommands(self):
     if self._IsServerAlive():
         return BaseRequest.PostDataToHandler(BuildRequestData(),
                                              'defined_subcommands')
     else:
         return []
예제 #18
0
    def _ThreadMain(self):
        while True:
            time.sleep(self._ping_interval_seconds)

            BaseRequest().GetDataFromHandler('healthy', display_message=False)
예제 #19
0
 def GetDefinedSubcommands(self):
     with HandleServerException():
         return BaseRequest.PostDataToHandler(BuildRequestData(),
                                              'defined_subcommands')
     return []
예제 #20
0
def _LoadExtraConfFile(filepath):
    BaseRequest.PostDataToHandler({'filepath': filepath},
                                  'load_extra_conf_file')
예제 #21
0
    def _ThreadMain(self):
        while True:
            time.sleep(self._ping_interval_seconds)

            with HandleServerException(display=False):
                BaseRequest.GetDataFromHandler('healthy')