Adding the YcmDebugInfo command

This commit is contained in:
Strahinja Val Markovic 2013-01-26 11:44:42 -08:00
parent 90c495a9c7
commit e8b60fd537
6 changed files with 47 additions and 0 deletions

View File

@ -405,6 +405,17 @@ function! youcompleteme#CurrentFileDiagnostics()
endfunction endfunction
function! s:DebugInfo()
echom "Printing YouCompleteMe debug information..."
let debug_info = pyeval( 'ycm_state.DebugInfo()' )
for line in split( debug_info, "\n" )
echom '-- ' . line
endfor
endfunction
command! YcmDebugInfo call s:DebugInfo()
" This is basic vim plugin boilerplate " This is basic vim plugin boilerplate
let &cpo = s:save_cpo let &cpo = s:save_cpo
unlet s:save_cpo unlet s:save_cpo

View File

@ -196,4 +196,8 @@ Diagnostic DiagnosticWrapToDiagnostic( DiagnosticWrap diagnostic_wrap ) {
return diagnostic; return diagnostic;
} }
std::string ClangVersion() {
return CXStringToString( clang_getClangVersion() );
}
} // namespace YouCompleteMe } // namespace YouCompleteMe

View File

@ -42,6 +42,8 @@ std::vector< CXUnsavedFile > ToCXUnsavedFiles(
Diagnostic DiagnosticWrapToDiagnostic( DiagnosticWrap diagnostic_wrap ); Diagnostic DiagnosticWrapToDiagnostic( DiagnosticWrap diagnostic_wrap );
std::string ClangVersion();
} // namespace YouCompleteMe } // namespace YouCompleteMe
#endif /* end of include guard: CLANGUTILS_H_9MVHQLJS */ #endif /* end of include guard: CLANGUTILS_H_9MVHQLJS */

View File

@ -20,6 +20,7 @@
#ifdef USE_CLANG_COMPLETER #ifdef USE_CLANG_COMPLETER
# include "ClangCompleter.h" # include "ClangCompleter.h"
# include "ClangUtils.h"
# include "CompletionData.h" # include "CompletionData.h"
# include "Diagnostic.h" # include "Diagnostic.h"
# include "UnsavedFile.h" # include "UnsavedFile.h"
@ -70,6 +71,8 @@ BOOST_PYTHON_MODULE(ycm_core)
.def( "GetResults", &Future< void >::GetResults ); .def( "GetResults", &Future< void >::GetResults );
#ifdef USE_CLANG_COMPLETER #ifdef USE_CLANG_COMPLETER
def( "ClangVersion", ClangVersion );
class_< Future< AsyncCompletions > >( "FutureCompletions" ) class_< Future< AsyncCompletions > >( "FutureCompletions" )
.def( "ResultsReady", &Future< AsyncCompletions >::ResultsReady ) .def( "ResultsReady", &Future< AsyncCompletions >::ResultsReady )
.def( "GetResults", &Future< AsyncCompletions >::GetResults ); .def( "GetResults", &Future< AsyncCompletions >::GetResults );

View File

@ -90,3 +90,7 @@ class Completer( object ):
@abc.abstractmethod @abc.abstractmethod
def ShouldUseNow( self, start_column ): def ShouldUseNow( self, start_column ):
pass pass
def DebugInfo( self ):
return ''

View File

@ -23,6 +23,7 @@ import vim
import utils import utils
import os import os
import sys import sys
import ycm_core
from completers.all.identifier_completer import IdentifierCompleter from completers.all.identifier_completer import IdentifierCompleter
FILETYPE_SPECIFIC_COMPLETION_TO_DISABLE = vim.eval( FILETYPE_SPECIFIC_COMPLETION_TO_DISABLE = vim.eval(
@ -124,6 +125,28 @@ class YouCompleteMe( object ):
self.GetFiletypeCompleterForCurrentFile().OnCurrentIdentifierFinished() self.GetFiletypeCompleterForCurrentFile().OnCurrentIdentifierFinished()
def DebugInfo( self ):
completers = set( self.filetype_completers.values() )
completers.add( self.identcomp )
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 _PathToCompletersFolder(): def _PathToCompletersFolder():
dir_of_current_script = os.path.dirname( os.path.abspath( __file__ ) ) dir_of_current_script = os.path.dirname( os.path.abspath( __file__ ) )
return os.path.join( dir_of_current_script, 'completers' ) return os.path.join( dir_of_current_script, 'completers' )