Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work at after pressing . or :: What should I do in order to make it work? #463

Open
jlstr opened this issue Nov 1, 2015 · 17 comments

Comments

@jlstr
Copy link

jlstr commented Nov 1, 2015

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.

@tony
Copy link
Contributor

tony commented Jan 18, 2016

Hello, I am experiencing this same issue on neovim with deoplete + clang_complete: Shougo/deoplete.nvim#125 (comment)

@Shougo: Can you elaborate on what the problem seems to be?

@Shougo
Copy link

Shougo commented Jan 18, 2016

tony added a commit to tony/clang_complete that referenced this issue Jan 18, 2016
@jlstr
Copy link
Author

jlstr commented Jan 18, 2016

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

@xaizek
Copy link
Collaborator

xaizek commented Jan 18, 2016

@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.

@jlstr
Copy link
Author

jlstr commented Jan 20, 2016

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?

@xaizek
Copy link
Collaborator

xaizek commented Jan 20, 2016

filetype off

Why? This might be the reason completion doesn't work for you. Try setting filetype on instead.

@jlstr
Copy link
Author

jlstr commented Jan 20, 2016

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

@jlstr
Copy link
Author

jlstr commented Jan 21, 2016

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.

@xaizek
Copy link
Collaborator

xaizek commented Jan 21, 2016

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.

@jlstr
Copy link
Author

jlstr commented Jan 21, 2016

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?

@jlstr
Copy link
Author

jlstr commented Jan 21, 2016

Regarding the python bindings, I have No Idea what are those, are those related to the --with-python install option macvim has?

@xaizek
Copy link
Collaborator

xaizek commented Jan 21, 2016

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.

@jsfaint
Copy link

jsfaint commented Jan 22, 2016

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"

1

@jlstr
Copy link
Author

jlstr commented Jan 22, 2016

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.

@Shougo
Copy link

Shougo commented Jan 26, 2016

@xaizek Sorry, clang_complete.py should set input_pattern instead of min_pattern_length.

deoplete-plugins/deoplete-go#7

xaizek added a commit that referenced this issue Jan 26, 2016
See #463 (comment)

This is a new option though, so probably needs latest deoplete.
@xaizek
Copy link
Collaborator

xaizek commented Jan 26, 2016

@Shougo, thanks for the notice, updated.

@Shougo
Copy link

Shougo commented Jan 26, 2016

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants