Skip to content
Charles Qiu edited this page Mar 9, 2016 · 15 revisions

YouCompleteMe无法补全某些C/C++头文件

需要对~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py文件进行配置。 在.ycm_extra_conf.py的flags数组中加入头文件对应的全路径。例如:

'-isystem',
'/usr/include',
'-isystem',
'/usr/include/c++/4.8'

YouCompleteMe编译时,加上“--system-libclang”参数会报错

安装了clang后,如果出现以下错误,

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
TEMP
    linked by target "ycm_core" in directory /Users/joe/.vim/bundle/YouCompleteMe/cpp/ycm

-- Configuring incomplete, errors occurred!

请执行以下命令:

# Ubuntu (x取决于clang版本)
cd /usr/lib/llvm-3.x/lib/ && sudo ln -s libclang.so.1 libclang.so

# OpenSUSE (x取决于clang版本)
cd /usr/lib64/ && sudo ln -s libclang.so.3.x libclang.so

Javascript代码无法自动补全

Javascript代码无法自动补全,并提示以下错误:

RuntimeError: Warning: Unable to detect a .tern-project file in the hierarchy before xxxxx and no global .tern-config file was found. This is required for accurate JavaScript completion. Please see the User Guide for details.

解决方法:在js项目根目录,创建文件.tern-project,内容如下(根据需要进行相应调整):

{
    "ecmaVersion": 6,
    "libs": [
        "browser",
        "jquery",
        "underscore"
    ],
    "loadEagerly": [
        "path/to/your/js/**/*.js"
    ],
    "dontLoad": [
        "path/to/your/js/**/*.js"
    ],
    "plugins": {
        "complete_strings": {},
        "node": {},
        "angular": {},
        "requirejs": {
            "baseURL": "./",
            "paths": {}
        },
        "modules": {},
        "es_modules": {},
        "doc_comment": {
            "fullDocs": true
        }
    }
}

更多plugins选项,请参考这里

Java, Ruby, PHP代码无法自动补全

Java, Ruby, PHP代码采用Eclim插件进行补全,如果遇到代码无法自动补全,请参考这里

Clone this wiki locally