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 pass
def DebugInfo( self ): def DebugInfo( self, request_data ):
return '' return ''

View File

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

View File

@ -128,6 +128,26 @@ def DefinedSubcommands():
return _JsonResponse( completer.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 # The type of the param is Bottle.HTTPError
@app.error( httplib.INTERNAL_SERVER_ERROR ) @app.error( httplib.INTERNAL_SERVER_ERROR )
def ErrorHandler( httperror ): def ErrorHandler( httperror ):

View File

@ -19,7 +19,6 @@
import os import os
import vim import vim
import ycm_core
import subprocess import subprocess
import tempfile import tempfile
import json import json
@ -203,24 +202,8 @@ class YouCompleteMe( object ):
def DebugInfo( self ): def DebugInfo( self ):
completers = set( self._filetype_completers.values() ) return BaseRequest.PostDataToHandler( BuildRequestData(),
completers.add( self._gencomp ) 'debug_info' )
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 )
def CurrentFiletypeCompletionEnabled( self ): def CurrentFiletypeCompletionEnabled( self ):