10

I'd like to use YouCompleteMe with C++ semantic completion, but after hours of trying, I can't find why it doesn't work as expected.

Everything seems to be working but I can't complete function parameters.

I'm running Vim on Archlinux (Gnome Terminal on Openbox):

Linux Arch-PC 4.2.5-1-ARCH #1 SMP PREEMPT Tue Oct 27 08:13:28 CET 2015 x86_64 GNU/Linux

I installed YCM following the instructions (with the install.py script and clang support). I also tried with AUR YCM package and got the same issue.

YcmDebugInfo:

Printing YouCompleteMe debug information...
-- Server has Clang support compiled in: True
-- Clang version: clang version 3.7.0 (tags/RELEASE_370/final)
-- Flags for /home/arthur/vimtest/main.cpp loaded from /home/arthur/vimtest/.ycm
_extra_conf.py:
-- ['-x', 'c++', '-Wall', '-isystem', '/home/arthur/.vim/bundle/YouCompleteMe/th
ird_party/ycmd/ycmd/../clang_includes']
-- Server running at: http://127.0.0.1:54555
-- Server process ID: 11520
-- Server logfiles:
--   /tmp/ycm_temp/server_54555_stdout.log
--   /tmp/ycm_temp/server_54555_stderr.log

That's what appears on screen when trying to complete: YCM issue

I used YCM-Generator for the .ycm_extra_conf.py.

Am I just missing something stupid due to my lack of Vim knowledge? Seems to be something like bad keyboard shortcuts mapping... but can't figure out what's wrong exactly. This is my .vimrc:

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

    " let Vundle manage Vundle, required
    Plugin 'VundleVim/Vundle.vim'

    Plugin 'scrooloose/nerdtree'
    Plugin 'mbbill/undotree'
    Plugin 'majutsushi/tagbar'
    Plugin 'bling/vim-airline'
    Plugin 'tpope/vim-fugitive'
    Plugin 'vim-scripts/c.vim'
    Plugin 'Valloric/YouCompleteMe'
    Plugin 'sjl/badwolf'        
    Plugin 'rdnetto/YCM-Generator'

call vundle#end()            " required
filetype plugin on    " required

"Settings
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set smartindent
set autoindent
set backspace=indent,eol,start
set background=dark 
set shiftround
set ignorecase
set showmode
set ruler
set showcmd
set mouse=a
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif

"Plugins Settings :
    "badwolf
        colorscheme badwolf
    "YCM :
        let g:ycm_collect_identifiers_from_tags_files = 1
    "airline :
        set laststatus=2
        let g:airline_powerline_fonts = 1




"Shortcuts
    nnoremap <F3>  :UndotreeToggle<cr> 
    nnoremap <F4>  :TagbarToggle<cr> 
    nnoremap <F2>  :NERDTreeToggle<cr> 


syn on
set nu

Thanks for your help!

1 Answer 1

9

Finally found it! Completing parameters is not a part of the YCM behaviour. See this YCM issue.

There's an old fork from oblitum which could grant this feature. That's what misled me.

Unfortunately, this part of the fork seems unmaintained and after a few tries I couldn't make it work.

So, I tried out clang_completer which has the parameter completion feature I was looking for.

5
  • 1
    Would that clang_completer be github.com/Rip-Rip/clang_complete, or another plugin?
    – muru
    Jan 24, 2016 at 19:38
  • Yes, that's this plugin.
    – hippunk
    Jan 26, 2016 at 4:08
  • If you compile YCM with the --clang-completer, does it work then? I think I'm using the param completion all the time at work. Cannot check right now...
    – eckes
    Jan 28, 2016 at 18:04
  • my fork has been updated and refactored, it's on par with upstream master. What's not maintained is that branch specifically, I've abandoned that solution in favor of what's on fork's master now.
    – oblitum
    May 10, 2016 at 17:41
  • With --clangd-completer, newer versions of YCM support parameter hints.
    – Zoe
    May 25, 2020 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.