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