MCPcopy
hub / github.com/ycm-core/YouCompleteMe / HandleFuture

Method HandleFuture

python/ycm/client/base_request.py:63–95  ·  view source on GitHub ↗

Get the server response from a |future| object and catch any exception while doing so. If an exception is raised because of a unknown .ycm_extra_conf.py file, load the file or ignore it after asking the user. An identical request should be sent again to the server. For other exceptio

( self,
                    future,
                    display_message = True,
                    truncate_message = False )

Source from the content-addressed store, hash-verified

61
62
63 def HandleFuture( self,
64 future,
65 display_message = True,
66 truncate_message = False ):
67 """Get the server response from a |future| object and catch any exception
68 while doing so. If an exception is raised because of a unknown
69 .ycm_extra_conf.py file, load the file or ignore it after asking the user.
70 An identical request should be sent again to the server. For other
71 exceptions, log the exception and display its message to the user on the Vim
72 status line. Unset the |display_message| parameter to hide the message from
73 the user. Set the |truncate_message| parameter to avoid hit-enter prompts
74 from this message."""
75 try:
76 try:
77 return _JsonFromFuture( future )
78 except UnknownExtraConf as e:
79 if vimsupport.Confirm( str( e ) ):
80 _LoadExtraConfFile( e.extra_conf_file )
81 else:
82 _IgnoreExtraConfFile( e.extra_conf_file )
83 self._should_resend = True
84 except URLError as e:
85 # We don't display this exception to the user since it is likely to happen
86 # for each subsequent request (typically if the server crashed) and we
87 # don't want to spam the user with it.
88 _logger.error( e )
89
90 except Exception as e:
91 _logger.exception( 'Error while handling server response' )
92 if display_message:
93 DisplayServerException( e, truncate_message )
94
95 return None
96
97
98 # This method blocks

Callers 11

GetDataFromHandlerMethod · 0.95
PostDataToHandlerMethod · 0.95
ResponseMethod · 0.80
ResponseMethod · 0.80
ResponseMethod · 0.80
_ResponseMethod · 0.80
ResponseMethod · 0.80
ResponseMethod · 0.80
ResponseMethod · 0.80
PollMethod · 0.80
_RawResponseMethod · 0.80

Calls 4

_JsonFromFutureFunction · 0.85
_LoadExtraConfFileFunction · 0.85
_IgnoreExtraConfFileFunction · 0.85
DisplayServerExceptionFunction · 0.85

Tested by

no test coverage detected