-
Notifications
You must be signed in to change notification settings - Fork 308
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
Use clang lib directly with deoplete source for better performance #464
base: master
Are you sure you want to change the base?
Conversation
Maybe @expipiplus1 would be interested in testing this out a bit? |
I've noticed this behavior with other plugins too such as ghc-mod, it would be great to see this fixed. |
@DarkDefender I'm trying out your branch and it works nicely. Nice work. Why don't you finish the improvements you were suggesting to speed things up a bit more? |
Use @DarkDefender's clang_complete branch See also: xavierd/clang_complete#464
Use @DarkDefender's clang_complete branch See also: xavierd/clang_complete#464
@tony thanks for using my branch. I'll try to improve it a bit more when I have time. That probably won't be till the end of january though |
@DarkDefender To reproduce: Create struct B{int bar;}; Create #include "b.h"
struct A{int arr;};
int foo(){
A a;
B b;
b.<Complete here> When the cursor reaches With this setup I am able to complete the members of It's probably worth noting that I get that behaviour also with system includes such as |
@expipiplus1 Yes, I get that too. I didn't notice it before because it seems like deoplete completes the ".bar" for me anyways, but you are right that it doesn't work at first. If you write "b.bar" then remove some of bar clang complete manages to find it... Same thing with the vector include |
@DarkDefender, the description is similar to the issue addressed by #468. |
In my fiddling I set Although I'm unable to get completions for members of variables of type I'm not able to get completions for bar without typing in at least part of the name of the member. I do however get completion suggestions from the |
@expipiplus1 the "[M]" provider is from the built in deoplete sources. Check out the member.py file if you want to take a look at it. |
@expipiplus1 My latest commit should fix it. I also created a check so it doesn't try to complete empty lines now. BTW, is it save to assume that all empy lines begin with '\n'? EDIT: Nvm changed the newline check to "isspace()" instead |
That works a little better for suggesting completions after typing a period, however completions are still suggested after typing other characters such as semicolon or parentheses. It doesn't seem to do anything to fix the failed completion for I have a feeling that this inconsistency is due to a bug further up in clang_complete or in clang itself. |
Your vector example works for me now. So it should be fixed. I guess that you didn't forget to include it correctly? |
library_path + "/", # Google | ||
"/usr/lib64/clang", # x86_64 (openSUSE, Fedora) | ||
"/usr/lib/clang" | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brew installs llvm stuff into:
LDFLAGS: -L/usr/local/opt/llvm/lib
CPPFLAGS: -I/usr/local/opt/llvm/include
Can we add that?
Can you rebase? |
On OS X:
Re: Config.set_library_path() or Config.set_library_file(, is there a way to programmatically add paths to check for clang? I seem to have the file there though, but OS X will do
brew install clang as a
|
@tony You should be able to manually specify where the clang lib is with "g:clang_library_path" . However I guess that the dylib loading problem is from the libclang-py3 lib and not my code. I see that in the libclang that clang_complete comes with it specifically looks for .dylib. But in libclang it is some automagic stuff instead:
And this is what is does in the one bundled in clang_complete:
Yes, I can rebase my code. But I guess it might be better to do that later when all quirks has been worked out. Or do you need me to rebase for any specific reason? |
Is this currently going anywhere? It would be a shame for it to become lost. |
@expipiplus1 I'm using https://github.com/zchee/deoplete-clang instead. |
Gotcha, thanks @DarkDefender |
Before I implemented these changes, the clang_complete deoplete source would cause neovim to freeze while it were gathering completion results.
I think this is because previously the deoplete thread would call the vim script portion of clang_complete to get completion candidates. And then vim would freeze till that call was completed.
Because this kinda defeates the async nature of deoplete, I decided that I would try to move out the completion candidates search to the deoplete thread.
This code requires that https://pypi.python.org/pypi/libclang-py3 is installed (deoplete is python3)
I basically just copy pasted the python part of clang_complete and converted it to python3.
I'm not sure everything is working correctly though. But it seems to me like I get the same completion results as before at least.
The completion results are still generated quite slowly though. But now it doesn't cause neovim to freeze while it's going it :)
This could be improved further by eliminating the remaining "vim.eval" calls. I guess you can't eliminate all of them, but only calling them when absolutely need could speed things up further.
Even if this might not be merged I would really like some input and feedback on it.