Fix YcmShowDetailedDiagnostic command on line without a diagnostic
The YcmShowDetailedDiagnostic command raises a NoneType exception on a line with no diagnostic.
This commit is contained in:
parent
e5b28f5c32
commit
a7ec7a6cd9
@ -1900,8 +1900,8 @@ The *GoToDeclaration* subcommand
|
||||
|
||||
Looks up the symbol under the cursor and jumps to its declaration.
|
||||
|
||||
Supported in filetypes: 'c, cpp, objc, objcpp, cuda, cs, go, java, python, rust,
|
||||
typescript'
|
||||
Supported in filetypes: 'c, cpp, objc, objcpp, cuda, cs, go, java, python,
|
||||
rust, typescript'
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
The *GoToDefinition* subcommand
|
||||
|
@ -386,6 +386,22 @@ def YouCompleteMe_ShowDetailedDiagnostic_MessageFromServer_test(
|
||||
] )
|
||||
|
||||
|
||||
@YouCompleteMeInstance()
|
||||
@patch( 'ycm.vimsupport.PostVimMessage', new_callable = ExtendedMock )
|
||||
def YouCompleteMe_ShowDetailedDiagnostic_Exception_test(
|
||||
ycm, post_vim_message ):
|
||||
|
||||
current_buffer = VimBuffer( 'buffer' )
|
||||
with MockVimBuffers( [ current_buffer ], current_buffer ):
|
||||
with patch( 'ycm.client.base_request._JsonFromFuture',
|
||||
side_effect = RuntimeError( 'Some exception' ) ):
|
||||
ycm.ShowDetailedDiagnostic(),
|
||||
|
||||
post_vim_message.assert_has_exact_calls( [
|
||||
call( 'Some exception', truncate = False )
|
||||
] )
|
||||
|
||||
|
||||
@YouCompleteMeInstance()
|
||||
@patch( 'ycm.vimsupport.PostVimMessage', new_callable = ExtendedMock )
|
||||
def YouCompleteMe_ShowDiagnostics_FiletypeNotSupported_test( ycm,
|
||||
|
@ -660,7 +660,7 @@ class YouCompleteMe( object ):
|
||||
detailed_diagnostic = BaseRequest().PostDataToHandler(
|
||||
BuildRequestData(), 'detailed_diagnostic' )
|
||||
|
||||
if 'message' in detailed_diagnostic:
|
||||
if detailed_diagnostic and 'message' in detailed_diagnostic:
|
||||
vimsupport.PostVimMessage( detailed_diagnostic[ 'message' ],
|
||||
warning = False )
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user