Open ababo opened 4 years ago
Hi @ababo!
Try this:
clang format
.Clang Format: Select Style
command.File
from the menu.Now it should honour the .clang-format
file.
I found this when I was trying to solve the same problem. If you open default package settings, they look like this:
{
// This is the path to the binary for clang-format. If it is in your path,
// it should just work out-of-the-box. Otherwise, you can set the full path,
// which will look like this:
// "binary": "/path/to/clang/bin/clang-format"
// Note that you can set this from within ST directly through the Command
// Palette.
"binary": "clang-format",
// We use the Google style by default. This can be selected from ST using
// the Command Palette. Choosing 'Custom' means that the settings will
// be loaded from the Sublime Text settings file (which is accessed
// from within ST through preferences. Choosing 'File' will look in the
// local directories from a clang-format settings file. See the clang-format
// documentation to see how this works.
"style": "Google",
// Setting this to true will run the formatter on every save. If you want to
// only enable this for a given project, try checking out the package
// "Project-Specific".
"format_on_save": false,
// If format_on_save is set to true, ClangFormat checks if the current file
// has its syntax set to a language in the list below. If it is in the list,
// then the file will be formatted by ClangFormat.
"languages": ["C", "C++", "C++11", "JavaScript", "Objective-C", "Objective-C++"]
}
The style
config key has a comment that describes various options including the File
.
I hope this helps :-)
I need to pass
IncludeBlocks: Preserve
intoclang-format
and I don't know how to do it. The config file in the root of my project directory is just ignored.clang-format
works properly when being launched from terminal.