Alaya-HY 发布于 2017/05/07 20:31
阅读 713
收藏 1





3. Configure your includes

Using CMake?

Plugin will run cmake on a proper CMakeLists.txt in your project folder and will use information from it to complete your code out of the box.

Have a compilation database?

Plugin will search for a compilation database compile_commands.json in the project folder and will load it to complete your code. If you want to specify a custom path to a comilation database you can do it in settings:


"flags_sources": [
    {"file": "compile_commands.json", "search_in": "<YOUR_PATH>"},

None of the above?

You will need a little bit of manual setup for now. Clang will automatically search for headers in the folder that contains the file you are working on and its parent. If you have a more sophisticated project you will need to help clang just a little bit. There are three ways to do it.

Pick ANY of the following:

  • Set include dirs in "common_flags" setting in User Settings:
    • See default settings to get started. These flags will be included in every project you run.
  • Add .clang_complete file to the root of your project folder.
    • This file should contain all includes and macroses you want to use.
    • Example file contents:
    • -Isrc -I/usr/include
  • Override "common_flags" setting in your project file! Just define the same setting in project specific settings with either one of two prefixes: "ecc_" or "easy_clang_complete_". See the project file in this repo for a working example. Minimal example for clarity: { "settings": { "ecc_common_flags": ["-Isrc", "-I/usr/include"], "easy_clang_complete_verbose": true } }

These settings are prioritized in a configurable way. Check out the settings to learn more about it.

That's it! You're ready to use the plugin!