-
Notifications
You must be signed in to change notification settings - Fork 305
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
Autocomplete with cquery not working #228
Comments
As far as I can see your log, vim-lsp does not send current edting text to cquery. Could you pleae try again with following step?
|
Hi there, I just did it. I was trying to autocomple std::cou -> std::cout, but got no autocompletion results. Ive attached the log |
Weird, sometimes it works. Ive attached from when it worked, and autocompleted std::cout EDIT actually I dont have the log file for when it was working |
Hmm, I could not figure out why cquery does not return candidate of completion from The first log file (#228 (comment)) initialize
didOpen
didChange
document still not have completion
didChange
So completion was processed with text |
I also found a way to make it autocomplete std::cout. basically, I type in std::co, then open the autocomplete menu and select the first choice. Then I started to delete characters, and once I delete enough characters so that its just std::co showing, then I will see the suggestion for cout showing! |
Thank your report. BTW, I tried to install cquery on Ubuntu 18.04 but cquery crash when cquery receives completion. (I always use clangd) |
Im running Ubuntu 18.04 as well, cquery seems to run OK for me (no crash). I tried clangd as well, but it also could not complete std::cout. Ive attached a gif showing me using cquery, and how I can get the std::cout completion to show up by deleting characters. Also heres what the clangd completion looked like. I couldnt get it to show std::cout at all. Notice that I can still go to definition if I manually type it out (this has always worked) Heres the logs |
cqueryThe first gif, vim-lsp send request for completin with text
You seems type some keys. So the condidates are filtered in the popup window. (As far as I see from cquery.log, you selected Could you please try this?
clangdWhen open a file, vim-lsp start language server. This take bit while for ready. On my environment, It take about 5sec until be possible to do omni completion. So as far as I can see the second gif, it seems that langserver is not ready yet. |
Sorry just so you dont get confused, the logs and the gifs arent exactly the same. I forgot to turn on logging when I was making the gif, so the exact word I selected might be different from the gif. Also, I am using the omni complete function, ie in my vimrc I have set |
Please do try omnifunc and asyncomplete separately that will help us identify if the bug is in asyncomplete or omnifunc |
Hi, I tried waiting for clangd, but it didnt autocomplete std::cout. It must be finished initialization because I can see many other autocomplete suggestions showing, and I can also goto definition of std::cout. Good news though, I tried using asyncomplete and asyncomplete-lsp. |
btw, heres the log when it works with asyncomplete. Note that since it autocompletes as I type, theres probably a lot more completion requests |
If you are using asyncomplete please try the v2 branch. It has lot of improvements. |
Please be noticed that cquery is no more supported by its author and its community and current master branch is in mess a bit. Try with its latest release or |
@mkwork If itsn't supported we should remove it from the wiki. https://github.com/prabirshrestha/vim-lsp/wiki/Servers-cquery |
I guess it's better to make remark about stable version and possibly broken master. Also link to this issue could be provided. I can propose such form: ATTENTION: looks like |
Yeah, I just did a fresh install of vim-lsp and clangd, and everything seems to work now, so I think it was a cquery problem. Thanks for the help! |
Sorry to bother you . Could you give an config of vim-lsp on clangd? I have installed clangd and vim-lsp , but it seems can't work just for autocomplete. Will it come out the selection bar automatically when I input some words ? Or should i type Ctl+N when i want to use complete features? It seems like i still use original vim-autocomplete even after i config the vim-lsp. Hope for your reply . Thanks a lot. |
@Abbyyan I'm using the following config for clangd: if executable('clangd')
augroup vim_lsp_cpp
autocmd!
autocmd User lsp_setup call lsp#register_server({
\ 'name': 'clangd',
\ 'cmd': {server_info->['clangd']},
\ 'whitelist': ['c', 'cpp', 'objc', 'objcpp', 'cc'],
\ })
autocmd FileType c,cpp,objc,objcpp,cc setlocal omnifunc=lsp#complete
autocmd FileType c,cpp,objc,objcpp,cc setlocal keywordprg=:LspHover
autocmd FileType c,cpp,objc,objcpp,cc nnoremap <buffer> <C-]> :LspDefinition<CR>
autocmd FileType c,cpp,objc,objcpp,cc nnoremap <buffer> <F2> :LspRename<CR>
augroup end
endif You can start completion manually by pressing |
Hi, I have a simple cmake/c++ project to isolate the issue. Basically, I
#include <iostream>
, but vim-lsp cannot seem to findstd::cout
. However I can still go to the definition ofstd::cout
using LspDefinition after typing outstd::cout
myself.Here's main.cpp (~/Documents/test/main.cpp)
compile_commands.json (~/Documents/test/build/compile_commands.json and symlink ~/Documents/test/compile_commands.json)
I've attached the log
The completion request from vim-lsp looks ok, but then the server replies with isInComplete=True.
However, I do not think this is a cquery problem, since I tried the same thing in emacs using the emacs-cquery plugin, and was able to autocomplete std::cout.
Also, this problem happens with local includes as well. I tried adding file ~/Documents/test/foo.h:
and modify ~/Documents/test/main.cpp:
Again, like the std::cout example, lsp#complete cannot find the function foo. However, after I type in foo();, I can use LspDefinition just fine.
Thank you
The text was updated successfully, but these errors were encountered: