From a6a1e7c94918a9d50b21d80d61d9293d27dc3d0e Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Sat, 26 Jan 2013 17:29:18 -0800 Subject: [PATCH] Clear error message on ycm_core ImportError --- python/vimsupport.py | 3 +-- python/ycm.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/python/vimsupport.py b/python/vimsupport.py index 19c8f915..f0120bb5 100644 --- a/python/vimsupport.py +++ b/python/vimsupport.py @@ -55,9 +55,8 @@ def NumLinesInBuffer( buffer ): def PostVimMessage( message ): - # TODO: escape the message string before formating it vim.command( 'echohl WarningMsg | echomsg "{0}" | echohl None' - .format( message ) ) + .format( message.replace( '"', '\\"' ) ) ) def EchoText( text ): diff --git a/python/ycm.py b/python/ycm.py index ee6836af..b77319f1 100644 --- a/python/ycm.py +++ b/python/ycm.py @@ -23,9 +23,19 @@ import vim import utils import os import sys -import ycm_core + +try: + import ycm_core +except ImportError, e: + vimsupport.PostVimMessage( + 'Error importing ycm_core. Are you sure you have placed a version 3.2+ ' + 'libclang.[so|dll|dylib] in folder "{0}"? See the Installation Guide in ' + 'the docs. Full error: {1}'.format( + os.path.dirname( os.path.abspath( __file__ ) ), str( e ) ) ) + from completers.all.identifier_completer import IdentifierCompleter + FILETYPE_SPECIFIC_COMPLETION_TO_DISABLE = vim.eval( 'g:ycm_filetype_specific_completion_to_disable' )