Better client notice when ycmd crashes
Now we only show the last 30 lines of stderr instead of everything in it which was not very useful. We also tell the user about :YcmRestartServer.
This commit is contained in:
parent
9ea0c39279
commit
aa0ccdb925
@ -50,9 +50,13 @@ except ImportError:
|
||||
# https://github.com/kennethreitz/requests/issues/879
|
||||
os.environ['no_proxy'] = '127.0.0.1,localhost'
|
||||
|
||||
SERVER_CRASH_MESSAGE_STDERR_FILE = 'The ycmd server SHUT DOWN with output:\n'
|
||||
NUM_YCMD_STDERR_LINES_ON_CRASH = 30
|
||||
SERVER_CRASH_MESSAGE_STDERR_FILE = (
|
||||
'The ycmd server SHUT DOWN (restart with :YcmRestartServer). ' +
|
||||
'Stderr (last {0} lines):\n\n'.format( NUM_YCMD_STDERR_LINES_ON_CRASH ) )
|
||||
SERVER_CRASH_MESSAGE_SAME_STDERR = (
|
||||
'The ycmd server shut down, check console output for logs!' )
|
||||
'The ycmd server SHUT DOWN (restart with :YcmRestartServer). '
|
||||
' check console output for logs!' )
|
||||
|
||||
|
||||
class YouCompleteMe( object ):
|
||||
@ -114,8 +118,10 @@ class YouCompleteMe( object ):
|
||||
return
|
||||
if self._server_stderr:
|
||||
with open( self._server_stderr, 'r' ) as server_stderr_file:
|
||||
error_output = ''.join( server_stderr_file.readlines()[
|
||||
: - NUM_YCMD_STDERR_LINES_ON_CRASH ] )
|
||||
vimsupport.PostMultiLineNotice( SERVER_CRASH_MESSAGE_STDERR_FILE +
|
||||
server_stderr_file.read() )
|
||||
error_output )
|
||||
else:
|
||||
vimsupport.PostVimMessage( SERVER_CRASH_MESSAGE_SAME_STDERR )
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user