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

Unable to complete loop constructs #553

Open
fandahao17 opened this issue Apr 18, 2018 · 4 comments
Open

Unable to complete loop constructs #553

fandahao17 opened this issue Apr 18, 2018 · 4 comments

Comments

@fandahao17
Copy link

Thank you for your excellent plugin!
I'm using Ubuntu17.10 with VIM 8 ,Clang 4.0.1 .After testing out all the features I found it unable to complete loop constructs.
This is my configurations in ~/.vimrc :

let g:clang_library_path='/usr/lib/llvm-4.0/lib/libclang-4.0.so.1'
let g:clang_snippets = 1 
let g:clang_use_library = 1 
let g:clang_auto_select = 2 
let g:clang_complete_macros = 1 
let g:clang_complete_patterns = 1 
let g:clang_trailing_placeholder = 1 

When I open a C source file and check
let g:clang_complete_patterns
It turns out :
g:clang_complete_patterns #1
I also checked
let g:clang_complete_lib_flags
and it seemed no problem as well
g:clang_complete_lib_flags #3

But when I type for<C-X><C-U> ,expecting clang_complete to complete the whole loop construct, it reports "Pattern not found" and my quickfix list shows nothing wrong.The same problem occurs when I tries the while loop and the do-while loop.
This has been confusing me for a few days, but I haven't got any idea of what's going wrong.
So what possibly caused the failure of the completion of code patterns? Are there any prerequisites to completing a loop construct?
BTW,the g:clang_trailing_placeholder option doesn't seem to work as well, but it can complete snippets like function parameters.So I don't know whether my problem is related to the snippet engine(I'm using 'clang_complete' as my snippet engine as default).

@xaizek
Copy link
Collaborator

xaizek commented Apr 18, 2018

clang_complete has never completed any loops, it completes identifiers like names of variables, types, macros and functions.

@fandahao17
Copy link
Author

Thanks.....But what does the "loop constructs" here refer to?

                                        clang_complete-complete_patterns
                                        g:clang_complete_patterns
If clang should complete code patterns, i.e loop constructs etc.
Default: 0

@xaizek
Copy link
Collaborator

xaizek commented Apr 18, 2018

I must be wrong then, haven't used the plugin for a long time. It seems to match doxygen, but I don't remember how to trigger it (maybe there shouldn't be any prefix at all?).

@fandahao17
Copy link
Author

fandahao17 commented Apr 19, 2018

Triggering code completion without any prefix doesn't work either.It just lists out a long list of all the possible selections. The option clang_complete_patterns doesn't change the completion result at all.
I tried to trigger Clang code completion manually in the command line:
$ clang -fsyntax-only -fno-caret-diagnostics -fdiagnostics-print-source-range-info -Xclang -code-completion-at='MyFile.c':6:3 'MyFile.c' -Xclang -x -Xclang c -Xclang -code-completion-patterns -Wall
The output contains loop constructs like:

COMPLETION: Pattern : for(<#init-statement#>;<#condition#>;<#inc-expression#>){
<#statements#>
}

It seems my Clang is able to complete code patterns, I doubt if clang_complete still provides code pattern completion now.

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

2 participants