No error when no clang support and cpp file opened

Previously, when the user opened a cpp/c/objc/objcpp file and clang support was
not compiled in, there would be an error message printed in vim.
This commit is contained in:
Strahinja Val Markovic 2013-01-13 20:56:10 -08:00
parent cc53a46f54
commit 5ac3d40691
9 changed files with 47 additions and 13 deletions

View File

@ -295,7 +295,7 @@ function! s:InvokeCompletion()
" This is tricky. First, having 'refresh' set to 'always' in the dictionary
" that our completion function returns makes sure that our completion function
" is called on every keystroke. Secondly, when the sequence of characters the
" is called on every keystroke. Second, when the sequence of characters the
" user typed produces no results in our search an infinite loop can occur. The
" problem is that our feedkeys call triggers the OnCursorMovedI event which we
" are tied to. We prevent this infinite loop from starting by making sure that

View File

@ -46,6 +46,13 @@ if ( USE_CLANG_COMPLETER AND
"You HAVE to pick one option. See the docs for more information.")
endif()
if ( USE_CLANG_COMPLETER )
message( "Using libclang to provide semantic completion for C/C++/ObjC" )
else()
message( "NOT using libclang, no semantic completion for C/C++/ObjC will be "
"available" )
endif()
if ( PATH_TO_LLVM_ROOT )
set( CLANG_INCLUDES_DIR "${PATH_TO_LLVM_ROOT}/include" )
else()

View File

@ -29,11 +29,23 @@
#include <boost/utility.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
bool HasClangSupport()
{
#ifdef USE_CLANG_COMPLETER
return true;
#else
return false;
#endif // USE_CLANG_COMPLETER
}
BOOST_PYTHON_MODULE(ycm_core)
{
using namespace boost::python;
using namespace YouCompleteMe;
def( "HasClangSupport", HasClangSupport );
class_< IdentifierCompleter, boost::noncopyable >( "IdentifierCompleter" )
.def( "EnableThreading", &IdentifierCompleter::EnableThreading )
.def( "AddCandidatesToDatabase",

View File

@ -17,8 +17,6 @@
# You should have received a copy of the GNU General Public License
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
from identifier_completer import IdentifierCompleter
def GetCompleter():
return IdentifierCompleter()
return None

View File

@ -17,8 +17,12 @@
# You should have received a copy of the GNU General Public License
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
import ycm_core
from completers.cpp.clang_completer import ClangCompleter
def GetCompleter():
return ClangCompleter()
if ycm_core.HasClangSupport():
return ClangCompleter()
else:
return None

View File

@ -17,8 +17,12 @@
# You should have received a copy of the GNU General Public License
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
import ycm_core
from clang_completer import ClangCompleter
def GetCompleter():
return ClangCompleter()
if ycm_core.HasClangSupport():
return ClangCompleter()
else:
return None

View File

@ -17,8 +17,11 @@
# You should have received a copy of the GNU General Public License
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
import ycm_core
from completers.cpp.clang_completer import ClangCompleter
def GetCompleter():
return ClangCompleter()
if ycm_core.HasClangSupport():
return ClangCompleter()
else:
return None

View File

@ -17,8 +17,12 @@
# You should have received a copy of the GNU General Public License
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
import ycm_core
from completers.cpp.clang_completer import ClangCompleter
def GetCompleter():
return ClangCompleter()
if ycm_core.HasClangSupport():
return ClangCompleter()
else:
return None

View File

@ -49,6 +49,7 @@ class YouCompleteMe( object ):
module_path = _PathToFiletypeCompleterPluginLoader( filetype )
completer = None
supported_filetypes = [ filetype ]
if os.path.exists( module_path ):
sys.path.append( os.path.dirname( module_path ) )
@ -56,10 +57,11 @@ class YouCompleteMe( object ):
del sys.path[ -1 ]
completer = module.GetCompleter()
for supported_filetype in completer.SupportedFiletypes():
self.filetype_completers[ supported_filetype ] = completer
else:
self.filetype_completers[ filetype ] = None
if completer:
supported_filetypes.extend( completer.SupportedFiletypes() )
for supported_filetype in supported_filetypes:
self.filetype_completers[ supported_filetype ] = completer
return completer