Getting debug info works again

This commit is contained in:
Strahinja Val Markovic 2013-09-27 17:13:43 -07:00
parent c9b4e9ed3a
commit 3ca758a581
5 changed files with 28 additions and 24 deletions

View File

@ -319,7 +319,7 @@ class Completer( object ):
pass
def DebugInfo( self ):
def DebugInfo( self, request_data ):
return ''

View File

@ -319,10 +319,9 @@ class ClangCompleter( Completer ):
return ''
flags = self._FlagsForRequest( request_data ) or []
source = extra_conf_store.ModuleFileForSourceFile( filename )
return responses.BuildDisplayMessageResponse(
'Flags for {0} loaded from {1}:\n{2}'.format( filename,
source,
list( flags ) ) )
return 'Flags for {0} loaded from {1}:\n{2}'.format( filename,
source,
list( flags ) )
def _FlagsForRequest( self, request_data ):
filename = request_data[ 'filepath' ]

View File

@ -38,6 +38,8 @@ def BuildDescriptionOnlyGoToResponse( text ):
}
# TODO: Look at all the callers and ensure they are not using this instead of an
# exception.
def BuildDisplayMessageResponse( text ):
return {
'message': text

View File

@ -128,6 +128,26 @@ def DefinedSubcommands():
return _JsonResponse( completer.DefinedSubcommands() )
@app.post( '/debug_info')
def DebugInfo():
# This can't be at the top level because of possible extra conf preload
import ycm_core
LOGGER.info( 'Received debug info request')
output = []
has_clang_support = ycm_core.HasClangSupport()
output.append( 'Server has Clang support compiled in: {0}'.format(
has_clang_support ) )
if has_clang_support:
output.append( ycm_core.ClangVersion() )
request_data = request.json
output.append(
_GetCompleterForRequestData( request_data ).DebugInfo( request_data) )
return _JsonResponse( '\n'.join( output ) )
# The type of the param is Bottle.HTTPError
@app.error( httplib.INTERNAL_SERVER_ERROR )
def ErrorHandler( httperror ):

View File

@ -19,7 +19,6 @@
import os
import vim
import ycm_core
import subprocess
import tempfile
import json
@ -203,24 +202,8 @@ class YouCompleteMe( object ):
def DebugInfo( self ):
completers = set( self._filetype_completers.values() )
completers.add( self._gencomp )
output = []
for completer in completers:
if not completer:
continue
debug = completer.DebugInfo()
if debug:
output.append( debug )
has_clang_support = ycm_core.HasClangSupport()
output.append( 'Has Clang support compiled in: {0}'.format(
has_clang_support ) )
if has_clang_support:
output.append( ycm_core.ClangVersion() )
return '\n'.join( output )
return BaseRequest.PostDataToHandler( BuildRequestData(),
'debug_info' )
def CurrentFiletypeCompletionEnabled( self ):