EasyClangComplete auto-completion for human beings ¶
Simple start in just 3 steps!¶
1. Install this plugin from Package Control¶
- In Sublime Text press CTRL+Shift+P and
install
EasyClangComplete
2. Install clang¶
- Ubuntu :
sudo apt-get install clang
- OSX : ships
clang
by default. You are all set! - Windows : install the latest release from clang website.
- Other Systems : use your package manager or install from clang website.
- clang website: http://llvm.org/releases/download.html
Tip
Make sure clang
is available in your PATH
or that the setting clang binary is set to the full path to your clang
binary.
Windows MSYS clang config (click to expand)
On Windows, you can also use the clang
binaries provided by
MSYS2 with some additional configuration of
the Sublime Text environment. The most convenient way to do this is to
install the Environment
Settings
package and configure it with settings similar to the following:
{
"env": {
"Windows": {
"PATH": "C:\\msys64\\mingw64\\bin;C:\\msys64\\usr\\bin;%PATH%",
"MSYSTEM": "MINGW64",
"CHERE_INVOKING": "enabled_from_arguments"
}
}
}
This assumes MSYS2 is installed in the default location C:\\msys64
,
otherwise adjust the PATH
variable accordingly. After a restart of
Sublime Text, this will both make clang
available by manipulating
PATH
and add some additional variables to set the MSYS2 environment.
By changing PATH
and MSYSTEM
, it is also possible to switch between
the different MSYS2 environments.
3. Configure your compiler flags and include folders¶
CMake and .sublime-project¶
- Your code is inside a valid
.sublime-project
? - You are using
CMake
as your build system?
You're in luck! The 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! For more details, read here.
Tip
Make sure cmake
is available in your PATH
or that the setting cmake binary is set to the full path to your clang
binary.
Bazel (Linux and MacOS only)¶
If you have a Bazel project, just run the command ECC: (Bazel) Generate compile_commands.json
to generate a compilation database file. The plugin can then use this database to complete your code.
Other options¶
If you cannot use CMake or Bazel in your project there are multiple ways to configure the correct compiler flags. The plugin can use:
- Settings of the plugin:
common_flags
andlang_flags
- Compilation database:
compile_commands.json
. - A
.clang_complete
file in the folder of the project. - (experimental)
CppProperties.json
orc_cpp_properties.json
files just like Visual Studio Code does. - (experimental)
Makefile
: we can parse the recipes from a Makefile to generate proper flags.
You can read more in the Configure compiler flags menu on the left of this page.
Things to do after setting up¶
Dive into settings¶
There are numerous settings available for this plugin. You can find a comprehensive review of all those settings and how to properly use them in the Full settings guide menu on the left of this page.
Explore available commands¶
There is a number of commands that can be invoked from the command panel. See the full list in the Available commands section.
It's not you, it's me!¶
If this documentation cannot answer your question, or you have suggestions on how to improve it, do not hesitate to fire up an issue.