Skip to content

Commit

Permalink
YcmDiags now doesn't hang when no flags available
Browse files Browse the repository at this point in the history
Fixes #46
  • Loading branch information
Valloric committed Feb 6, 2013
1 parent 9bee28a commit 6f10d7a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
16 changes: 15 additions & 1 deletion autoload/youcompleteme.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions python/completers/completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ def GetDiagnosticsForCurrentFile( self ):
def ShowDetailedDiagnostic( self ):
pass

def GettingCompletions( self ):
return False


@abc.abstractmethod
def SupportedFiletypes( self ):
Expand Down
4 changes: 4 additions & 0 deletions python/completers/cpp/clang_completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ def DiagnosticsForCurrentFileReady( self ):
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 )
Expand Down
6 changes: 6 additions & 0 deletions python/ycm.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ def ShowDetailedDiagnostic( self ):
return self.GetFiletypeCompleterForCurrentFile().ShowDetailedDiagnostic()


def GettingCompletions( self ):
if self.FiletypeCompletionEnabledForCurrentFile():
return self.GetFiletypeCompleterForCurrentFile().GettingCompletions()
return False


def OnCurrentIdentifierFinished( self ):
self.identcomp.OnCurrentIdentifierFinished()

Expand Down

0 comments on commit 6f10d7a

Please sign in to comment.