clang_complete
clang_complete copied to clipboard
Does not work at after pressing . or :: What should I do in order to make it work?
Hello, I've been trying to use this Vim plugin and so far no success whatsoever. For example:
std::
doesn't do anything when I stop typing. Or:
std::vector<int> vec;
vec.
doesn't show any drop-down with methods either. I have no idea what to do in order to make it work, I have tried many of the options found in the docs: https://github.com/Rip-Rip/clang_complete/blob/master/doc/clang_complete.txt, Also, I have tried some of the answers in StackOverflow, etc
but it won't work at all. What should I do? I don't even know where to begin.
Hello, I am experiencing this same issue on neovim with deoplete + clang_complete: https://github.com/Shougo/deoplete.nvim/issues/125#issuecomment-172286463
@shougo: Can you elaborate on what the problem seems to be?
https://github.com/Rip-Rip/clang_complete/blob/master/rplugin/python3/deoplete/sources/clang_complete.py#L16
min_pattern_length should be 0.
Good thing that this issue was mentioned, because, I've recently installed clang_complete for Vim in a different machine (Mac OS X) and I'm experiencing similar problems, I have had no problems while using the scope operator std::
, that one completes just fine. BUT vec.
dot-type of completions don't always work retro-actively. ie. If I close VIM, then re-start it, then re-open a .cpp I was working on, then this type of completion vec.
usually Does Not work! (Diplays the infamous: User defined completion (^U^N^P) Pattern not found error), I read in the docs it's possibly because of some kind of VIM buffer thing or something?
Here's what I have on my .vimrc file:
let g:clang_library_path = '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib'
let g:clang_use_library = 1
let g:clang_user_options='|| exit 0'
let g:clang_close_preview = 1
let g:clang_snippets = 1
let g:clang_trailing_placeholder = 1
Notice that I'm pointing to XCode's installed libclang, I've always wondered if it's best to point to a clang installed separately via brew, but there aren't many guides out there on how to configure it that way
@jlstr, I would expect that if ::
completion works, then .
completion should work the same way. Maybe check :inoremap <buffer> .
for unexpected handlers, which could be set up by another plugin.
Hello there, thank you for the reply! here's the rest of .vimrc
file, sir.
set background=dark
set backspace=indent,eol,start
set completeopt=preview,menuone
set cpoptions=aAceFsB
set expandtab
set fileencodings=ucs-bom,utf-8,default,latin1
set guitablabel=%M%t
set helplang=en
set langmenu=none
set mouse=a
set shiftwidth=2
set tabstop=2
set termencoding=utf-8
set updatetime=2000
" vim: set ft=vim :
command! -nargs=* -bar -bang -count=0 -complete=dir E Explore <args>
colorscheme kalisi
set number
set nocompatible
filetype off
I have nothing else in it. What do you think?
filetype off
Why? This might be the reason completion doesn't work for you. Try setting filetype on
instead.
Didn't work, sir. Moreover... The problem is worse than I imagined, now all method dot completions aren't working: https://www.youtube.com/watch?v=rlQPgLfaacc
Here's my actual complete .vimrc
file too: https://gist.github.com/jlstr/f8ae21a39f831831e24f
Hello again! I really really hope you can help me out with this issue, I have removed ALL the other plugins that I had installed, re-installed clang_complete, and reduced my .vimrc
file to the most basic version I could: https://gist.github.com/jlstr/0772c15b65bc3f054564
And still, the problem remains! I can't do any completions of the type: vec.
(See video above).
This is driving me crazy, I can't get it to work, and I'm sure I have Googled the entire internet for answers.... but no luck.
Thank you very much in advance.
Maybe try using different libclang? In case current one can't find corresponding headers.
Hm, maybe python bindings to libclang used by clang_complete are too outdated and something goes completely wrong... That could probably explain what's going on here.
Interesting observations sir! now that you mention using a different libclang, I have to say that I recently installed Android Studio, and apparently it comes with its own libclang.
ie. /Users/jose/Library/Android/sdk/build-tools/23.0.2/lib/libclang.dylib
And If I put that one in my .vimrc
file it causes an error:
Loading libclang failed, completion won't be available. Are you sure '/Users/jose/Library/Android/sdk/build-tools/23.0.2/lib' contains libclang?
So, The obvious question is: Which different libclang do I install?, I have a gut feeling the problem is indeed libclang, but for Mac OS X the only that seems to be available..
$ brew search clang
clang-format clang-omp emacs-clang-complete-async
is clang-omp (https://clang-omp.github.io/), Do you recommend installing that one?
Regarding the python bindings, I have No Idea what are those, are those related to the --with-python
install option macvim has?
Please stop calling me "sir", it makes me feel uncomfortable :-)
Not an OS X user, just saw you mentioned homebrew having it. I think it might come with LLVM if you enable building clang for it (if it's not built by default).
Bindings are these: https://github.com/Rip-Rip/clang_complete/tree/master/plugin/clang They are required to be able to use libclang from python and are really old.
Also try setting let g:clang_debug = 1
, not sure how useful additional output will be, but anyway.
I use OS X 10.11.3 + mavim, this setting works for me.
let g:clang_library_path="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib"

Hi @jsfaint, thank you for your reply. I have the exact same line to invoke Xcode's installed libclang
, but variable-dot type completions (vec1.
) just don't work for me [see video link above]. I tried to uninstall macvim (that was installed via brew), and re-installed/compiled from source; I did this process twice, because when I installed clang_complete the first time, Vim warned me it wouldn't work unless I compiled with python... Therefore I did that, and I thought I was getting somewhere, but It didn't work either!
I also installed LLVM which indeed comes with its own version of libclang, but it didn't work either. So, I think I have officially given up with this plugin. Sad part is... YouCompleteMe has the exact same problem. Even though it installed perfectly, its output points to a myriad of live-compilation problems, mostly about missing headers, and protected variables. Headers that I don't think belong to core C++ btw. Anyways, that's my story, I don't know why it worked in my other Mac OS X computer seamlessly and it's so problematic in a new machine. Thank you for your replies guys.
@xaizek Sorry, clang_complete.py should set input_pattern
instead of min_pattern_length
.
https://github.com/zchee/deoplete-go/issues/7
@Shougo, thanks for the notice, updated.
:+1: