YcmShowDetailedDiagnostic works again
This commit is contained in:
parent
159a8ecdfa
commit
c43327d176
@ -562,7 +562,6 @@ function! youcompleteme#OmniComplete( findstart, base )
|
||||
endfunction
|
||||
|
||||
|
||||
" TODO: Make this work again
|
||||
function! s:ShowDetailedDiagnostic()
|
||||
py ycm_state.ShowDetailedDiagnostic()
|
||||
endfunction
|
||||
|
@ -227,13 +227,11 @@ class ClangCompleter( Completer ):
|
||||
current_file = request_data[ 'filepath' ]
|
||||
|
||||
if not self._diagnostic_store:
|
||||
return responses.BuildDisplayMessageResponse(
|
||||
NO_DIAGNOSTIC_MESSAGE )
|
||||
raise ValueError( NO_DIAGNOSTIC_MESSAGE )
|
||||
|
||||
diagnostics = self._diagnostic_store[ current_file ][ current_line ]
|
||||
if not diagnostics:
|
||||
return responses.BuildDisplayMessageResponse(
|
||||
NO_DIAGNOSTIC_MESSAGE )
|
||||
raise ValueError( NO_DIAGNOSTIC_MESSAGE )
|
||||
|
||||
closest_diagnostic = None
|
||||
distance_to_closest_diagnostic = 999
|
||||
|
@ -295,7 +295,8 @@ struct Foo {
|
||||
"""
|
||||
|
||||
filename = '/foo.cpp'
|
||||
diag_data = {
|
||||
event_data = {
|
||||
'event_name': 'FileReadyToParse',
|
||||
'compilation_flags': ['-x', 'c++'],
|
||||
'line_num': 0,
|
||||
'column_num': 0,
|
||||
@ -309,17 +310,50 @@ struct Foo {
|
||||
}
|
||||
}
|
||||
|
||||
results = app.post_json( '/event_notification', event_data ).json
|
||||
assert_that( results,
|
||||
contains(
|
||||
has_entries( { 'text': contains_string( "expected ';'" ),
|
||||
'line_num': 2,
|
||||
'column_num': 7 } ) ) )
|
||||
|
||||
|
||||
@with_setup( Setup )
|
||||
def GetDetailedDiagnostic_ClangCompleter_Works_test():
|
||||
app = TestApp( ycmd.app )
|
||||
contents = """
|
||||
struct Foo {
|
||||
int x // semicolon missing here!
|
||||
int y;
|
||||
int c;
|
||||
int d;
|
||||
};
|
||||
"""
|
||||
|
||||
filename = '/foo.cpp'
|
||||
diag_data = {
|
||||
'compilation_flags': ['-x', 'c++'],
|
||||
'line_num': 2,
|
||||
'column_num': 0,
|
||||
'filetypes': ['cpp'],
|
||||
'filepath': filename,
|
||||
'file_data': {
|
||||
filename: {
|
||||
'contents': contents,
|
||||
'filetypes': ['cpp']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event_data = diag_data.copy()
|
||||
event_data.update( {
|
||||
'event_name': 'FileReadyToParse',
|
||||
} )
|
||||
|
||||
results = app.post_json( '/event_notification', event_data ).json
|
||||
app.post_json( '/event_notification', event_data )
|
||||
results = app.post_json( '/detailed_diagnostic', diag_data ).json
|
||||
assert_that( results,
|
||||
contains(
|
||||
has_entries( { 'text': contains_string( "expected ';'" ),
|
||||
'line_num': 2,
|
||||
'column_num': 7 } ) ) )
|
||||
has_entry( 'message', contains_string( "expected ';'" ) ) )
|
||||
|
||||
|
||||
@with_setup( Setup )
|
||||
|
@ -133,6 +133,15 @@ def DefinedSubcommands():
|
||||
return _JsonResponse( completer.DefinedSubcommands() )
|
||||
|
||||
|
||||
@app.post( '/detailed_diagnostic')
|
||||
def GetDetailedDiagnostic():
|
||||
LOGGER.info( 'Received detailed diagnostic request')
|
||||
request_data = request.json
|
||||
completer = _GetCompleterForRequestData( request_data )
|
||||
|
||||
return _JsonResponse( completer.GetDetailedDiagnostic( request_data ) )
|
||||
|
||||
|
||||
@app.post( '/debug_info')
|
||||
def DebugInfo():
|
||||
# This can't be at the top level because of possible extra conf preload
|
||||
|
@ -194,11 +194,11 @@ class YouCompleteMe( object ):
|
||||
return []
|
||||
|
||||
|
||||
# TODO: Make this work again.
|
||||
def GetDetailedDiagnostic( self ):
|
||||
# if self.FiletypeCompletionUsable():
|
||||
# return self.GetFiletypeCompleter().GetDetailedDiagnostic()
|
||||
pass
|
||||
def ShowDetailedDiagnostic( self ):
|
||||
debug_info = BaseRequest.PostDataToHandler( BuildRequestData(),
|
||||
'detailed_diagnostic' )
|
||||
if 'message' in debug_info:
|
||||
vimsupport.EchoText( debug_info[ 'message' ] )
|
||||
|
||||
|
||||
def DebugInfo( self ):
|
||||
|
Loading…
Reference in New Issue
Block a user