Skip to content

Commit 1d15b86

Browse files
committed
Make sure to refresh diagnostic UI on InsertLeave
In case the current filetype language server uses LSP async diagnostics, we might not get a reparse on InsertLeave. This happens if the user leaves insert mode after a semantic trigger. We would still try sending a FileReadyToParse request, but the diags get ignored, because: a) The filetype is known to use async diags. b) We do not insist on a synchronous diag update, like :YcmDiags. The solution is to check if the current filetype uses async diagnostics and, if so, let InsertLeave refresh diagnostic UI regardless of what the state of FileReadyToParse request is. Note that this solution makes the flicker on leaving insert mode harder to fix. Not only does OnCursorMoved cause a refresh of stale diagnostics, but so does OnInsertLeave.
1 parent 9e02cfa commit 1d15b86

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

python/ycm/youcompleteme.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,8 +614,10 @@ def OnInsertEnter( self ):
614614

615615

616616
def OnInsertLeave( self ):
617+
async_diags = any( self._message_poll_requests.get( filetype )
618+
for filetype in vimsupport.CurrentFiletypes() )
617619
if ( not self._user_options[ 'update_diagnostics_in_insert_mode' ] and
618-
not self.CurrentBuffer().ParseRequestPending() ):
620+
( async_diags or not self.CurrentBuffer().ParseRequestPending() ) ):
619621
self.CurrentBuffer().RefreshDiagnosticsUI()
620622
SendEventNotificationAsync( 'InsertLeave' )
621623

0 commit comments

Comments
 (0)