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:
parent
cc53a46f54
commit
5ac3d40691
@ -295,7 +295,7 @@ function! s:InvokeCompletion()
|
|||||||
|
|
||||||
" This is tricky. First, having 'refresh' set to 'always' in the dictionary
|
" This is tricky. First, having 'refresh' set to 'always' in the dictionary
|
||||||
" that our completion function returns makes sure that our completion function
|
" 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
|
" 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
|
" 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
|
" are tied to. We prevent this infinite loop from starting by making sure that
|
||||||
|
@ -46,6 +46,13 @@ if ( USE_CLANG_COMPLETER AND
|
|||||||
"You HAVE to pick one option. See the docs for more information.")
|
"You HAVE to pick one option. See the docs for more information.")
|
||||||
endif()
|
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 )
|
if ( PATH_TO_LLVM_ROOT )
|
||||||
set( CLANG_INCLUDES_DIR "${PATH_TO_LLVM_ROOT}/include" )
|
set( CLANG_INCLUDES_DIR "${PATH_TO_LLVM_ROOT}/include" )
|
||||||
else()
|
else()
|
||||||
|
@ -29,11 +29,23 @@
|
|||||||
#include <boost/utility.hpp>
|
#include <boost/utility.hpp>
|
||||||
#include <boost/python/suite/indexing/vector_indexing_suite.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)
|
BOOST_PYTHON_MODULE(ycm_core)
|
||||||
{
|
{
|
||||||
using namespace boost::python;
|
using namespace boost::python;
|
||||||
using namespace YouCompleteMe;
|
using namespace YouCompleteMe;
|
||||||
|
|
||||||
|
def( "HasClangSupport", HasClangSupport );
|
||||||
|
|
||||||
class_< IdentifierCompleter, boost::noncopyable >( "IdentifierCompleter" )
|
class_< IdentifierCompleter, boost::noncopyable >( "IdentifierCompleter" )
|
||||||
.def( "EnableThreading", &IdentifierCompleter::EnableThreading )
|
.def( "EnableThreading", &IdentifierCompleter::EnableThreading )
|
||||||
.def( "AddCandidatesToDatabase",
|
.def( "AddCandidatesToDatabase",
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from identifier_completer import IdentifierCompleter
|
|
||||||
|
|
||||||
def GetCompleter():
|
def GetCompleter():
|
||||||
return IdentifierCompleter()
|
return None
|
||||||
|
|
||||||
|
@ -17,8 +17,12 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import ycm_core
|
||||||
from completers.cpp.clang_completer import ClangCompleter
|
from completers.cpp.clang_completer import ClangCompleter
|
||||||
|
|
||||||
def GetCompleter():
|
def GetCompleter():
|
||||||
|
if ycm_core.HasClangSupport():
|
||||||
return ClangCompleter()
|
return ClangCompleter()
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
@ -17,8 +17,12 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import ycm_core
|
||||||
from clang_completer import ClangCompleter
|
from clang_completer import ClangCompleter
|
||||||
|
|
||||||
def GetCompleter():
|
def GetCompleter():
|
||||||
|
if ycm_core.HasClangSupport():
|
||||||
return ClangCompleter()
|
return ClangCompleter()
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
@ -17,8 +17,11 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import ycm_core
|
||||||
from completers.cpp.clang_completer import ClangCompleter
|
from completers.cpp.clang_completer import ClangCompleter
|
||||||
|
|
||||||
def GetCompleter():
|
def GetCompleter():
|
||||||
|
if ycm_core.HasClangSupport():
|
||||||
return ClangCompleter()
|
return ClangCompleter()
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
@ -17,8 +17,12 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import ycm_core
|
||||||
from completers.cpp.clang_completer import ClangCompleter
|
from completers.cpp.clang_completer import ClangCompleter
|
||||||
|
|
||||||
def GetCompleter():
|
def GetCompleter():
|
||||||
|
if ycm_core.HasClangSupport():
|
||||||
return ClangCompleter()
|
return ClangCompleter()
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ class YouCompleteMe( object ):
|
|||||||
module_path = _PathToFiletypeCompleterPluginLoader( filetype )
|
module_path = _PathToFiletypeCompleterPluginLoader( filetype )
|
||||||
|
|
||||||
completer = None
|
completer = None
|
||||||
|
supported_filetypes = [ filetype ]
|
||||||
if os.path.exists( module_path ):
|
if os.path.exists( module_path ):
|
||||||
|
|
||||||
sys.path.append( os.path.dirname( module_path ) )
|
sys.path.append( os.path.dirname( module_path ) )
|
||||||
@ -56,10 +57,11 @@ class YouCompleteMe( object ):
|
|||||||
del sys.path[ -1 ]
|
del sys.path[ -1 ]
|
||||||
|
|
||||||
completer = module.GetCompleter()
|
completer = module.GetCompleter()
|
||||||
for supported_filetype in completer.SupportedFiletypes():
|
if completer:
|
||||||
|
supported_filetypes.extend( completer.SupportedFiletypes() )
|
||||||
|
|
||||||
|
for supported_filetype in supported_filetypes:
|
||||||
self.filetype_completers[ supported_filetype ] = completer
|
self.filetype_completers[ supported_filetype ] = completer
|
||||||
else:
|
|
||||||
self.filetype_completers[ filetype ] = None
|
|
||||||
return completer
|
return completer
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user