From b4837c81feb7ac8bacc87ff8c2920eabbecf6671 Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Sun, 24 Mar 2013 18:52:50 -0700 Subject: [PATCH] Handling exceptions in jedi_completer thread --- python/completers/python/jedi_completer.py | 27 ++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/python/completers/python/jedi_completer.py b/python/completers/python/jedi_completer.py index f957bbb6..e1abda17 100644 --- a/python/completers/python/jedi_completer.py +++ b/python/completers/python/jedi_completer.py @@ -84,20 +84,23 @@ class JediCompleter( Completer ): def SetCandidates( self ): while True: - WaitAndClear( self._query_ready ) + try: + WaitAndClear( self._query_ready ) - filename = vim.current.buffer.name - line, column = vimsupport.CurrentLineAndColumn() - # Jedi expects lines to start at 1, not 0 - line += 1 - contents = '\n'.join( vim.current.buffer ) - script = Script( contents, line, column, filename ) - - self._candidates = [ { 'word': str( completion.word ), - 'menu': str( completion.description ), - 'info': str( completion.doc ) } - for completion in script.complete() ] + filename = vim.current.buffer.name + line, column = vimsupport.CurrentLineAndColumn() + # Jedi expects lines to start at 1, not 0 + line += 1 + contents = '\n'.join( vim.current.buffer ) + script = Script( contents, line, column, filename ) + self._candidates = [ { 'word': str( completion.word ), + 'menu': str( completion.description ), + 'info': str( completion.doc ) } + for completion in script.complete() ] + except: + self._query_ready.clear() + self._candidates = [] self._candidates_ready.set()