YcmDiags now doesn't hang when no flags available

Fixes #46
This commit is contained in:
Strahinja Val Markovic 2013-02-05 21:22:50 -08:00
parent 9bee28a0a8
commit 6f10d7aad7
4 changed files with 28 additions and 1 deletions

View File

@ -438,13 +438,27 @@ function! s:ForceCompile()
if diagnostics_ready
break
endif
let getting_completions = pyeval(
\ 'ycm_state.GettingCompletions()' )
if !getting_completions
echom "Unable to retrieve diagnostics."
return 0
endif
sleep 100m
endwhile
return 1
endfunction
function! s:ForceCompileAndDiagnostics()
call s:ForceCompile()
let compilation_succeeded = s:ForceCompile()
if !compilation_succeeded
return
endif
call s:UpdateDiagnosticNotifications()
echom "Diagnostics refreshed."
endfunction

View File

@ -81,6 +81,9 @@ class Completer( object ):
def ShowDetailedDiagnostic( self ):
pass
def GettingCompletions( self ):
return False
@abc.abstractmethod
def SupportedFiletypes( self ):

View File

@ -146,6 +146,10 @@ class ClangCompleter( Completer ):
return self.parse_future.ResultsReady()
def GettingCompletions( self ):
return self.completer.UpdatingTranslationUnit( vim.current.buffer.name )
def GetDiagnosticsForCurrentFile( self ):
if self.DiagnosticsForCurrentFileReady():
diagnostics = self.completer.DiagnosticsForFile( vim.current.buffer.name )

View File

@ -141,6 +141,12 @@ class YouCompleteMe( object ):
return self.GetFiletypeCompleterForCurrentFile().ShowDetailedDiagnostic()
def GettingCompletions( self ):
if self.FiletypeCompletionEnabledForCurrentFile():
return self.GetFiletypeCompleterForCurrentFile().GettingCompletions()
return False
def OnCurrentIdentifierFinished( self ):
self.identcomp.OnCurrentIdentifierFinished()