Vim YouCompleteMe clang没有完成C ++ 11' auto'变量

时间:2015-02-22 16:43:10

标签: c++ vim autocomplete

我使用clang Completer作为YouCompleteMe vim插件。我发现它没有为声明为' auto'。

的变量提供预测

这是一个已知问题吗?如果没有,我应该为解决方案检查哪些可能的配置参数?

请考虑以下代码段:

std::vector <int> persistent_data_container = {1, 2, 3};
const auto &data = persistent_data_container;
data. // on typing this dot, I would expect a list of completion suggestions 

1 个答案:

答案 0 :(得分:0)

我最终使用以下方法隔离了问题:

:YcmForceCompileAndDiagnostics # To retry new config
:YcmDebugInfo # for debug info (derp!)
:messages # for runtime diagnostics

这指出我的.ycm_extra_conf.py模板中存在语法错误:

import os
import ycm_core
flags = ['-std=c++11',
         '-x', 'c++', # <- I had an extra comma here :(
         '-DUSE_CLANG_COMPLETER',
         '-I/usr/local/include',
         '-I/usr/include/clang/3.5/include',
         '-I/usr/include/x86_64-linux-gnu',
         '-I/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/include',
         '-I/usr/include',
         '-I/usr/include/c++/4.9', %s]

# youcompleteme is calling this function to get flags
# You can also set database for flags. Check: JSONCompilationDatabase.html in
# clang-3.2-doc package

def FlagsForFile( filename ):
  return {
    'flags': flags,
    'do_cache': True
  }