clang-format

clang-format style options for enums

℡╲_俬逩灬. 提交于 2019-11-30 07:00:28
Does anyone know how to configure clang-format to keep enum's on individual lines? i.e. enum { ONE, TOW, THREE }; vs. enum {ONE, TWO, THREE}; EDIT: Here are the style options i use to match Apple's Objective-C style guide. http://pastebin.com/0cTEhvBv This was intentionally introduced at some stage (so if you are unable to reproduce the behavior, you are likely on an older version). clang-format contracts enums to a single line if all elements fit on one line. This conserves spaces and usually does not decrease readability. There is no style option, but you can override this by either adding a

Using clang-format in CLion

情到浓时终转凉″ 提交于 2019-11-30 04:12:16
I'd like to format my code using clang-format in CLion. I've gone through the settings and haven't found any setting that would allow me to run an external command to transform code. How are such things normally done in CLion? You can use External Tools in CLion. Go to File->Settings->Tools->External Tools and click on the plus sign. A window should pop up. Use a name of your choice. For the Tool settings tab I'm using this configuration: Program: clang-format-3.7 (you should use the name of your executable here) Parameters: -i $FileName$ Working directory: $FileDir$ Now, with your file open,

How to feed Visual Studio Clang-Format plugin with clang-format file?

橙三吉。 提交于 2019-11-29 16:21:51
问题 So I downloaded, installed, and inserted into path the clang formatting plugin. I also tested it and it works for Google (Mozilla, etc.) formatting options out of the box, yet I cannot get it working with my .clang-format file. (I've put my file into the same folder as my source file, changed its encoding into UTF-8, also tried to put it into clang install folder, add file into project, write its contents inside '{key:value}' yet formatting does not happen). So how do you feed formatting file

clang-format: force arguments and parameters to one-line-each if the statement overflows

走远了吗. 提交于 2019-11-29 09:26:34
Is there a way to force arguments and parameters to one-line-each if a single or more character go past the overflow? For example: For example, this: if(value != "course" || value != "module" || value != "lesson" ) Should look like this: if(value != "course" || value != "module" || value != "lesson") Or this: if(value != "course" || value != "module" || value != "lesson") And this: void some_class::some_func(const std:string s, const std::string t ) Should look like this: void some_class::some_func(const std:string s, const std::string t) Or this: void some_class::some_func(const std:string s

clang-format style options for enums

三世轮回 提交于 2019-11-29 06:51:40
问题 Does anyone know how to configure clang-format to keep enum's on individual lines? i.e. enum { ONE, TOW, THREE }; vs. enum {ONE, TWO, THREE}; EDIT: Here are the style options i use to match Apple's Objective-C style guide. http://pastebin.com/0cTEhvBv 回答1: This was intentionally introduced at some stage (so if you are unable to reproduce the behavior, you are likely on an older version). clang-format contracts enums to a single line if all elements fit on one line. This conserves spaces and

Using clang-format in CLion

こ雲淡風輕ζ 提交于 2019-11-29 01:26:39
问题 I'd like to format my code using clang-format in CLion. I've gone through the settings and haven't found any setting that would allow me to run an external command to transform code. How are such things normally done in CLion? 回答1: You can use External Tools in CLion. Go to File->Settings->Tools->External Tools and click on the plus sign. A window should pop up. Use a name of your choice. For the Tool settings tab I'm using this configuration: Program: clang-format-3.7 (you should use the

Clang-format line breaks

房东的猫 提交于 2019-11-28 05:14:18
I'm looking for a clang-format setting to prevent the tool from removing line breaks. For example, I have my ColumnLimit set to 120, and here's what happens when I reformat some sample code. Before: #include <vector> #include <string> std::vector<std::string> get_vec() { return std::vector<std::string> { "this is a test", "some of the lines are longer", "than other, but I would like", "to keep them on separate lines" }; } int main() { auto vec = get_vec(); } After: #include <vector> #include <string> std::vector<std::string> get_vec() { return std::vector<std::string>{"this is a test", "some

clang-format: force arguments and parameters to one-line-each if the statement overflows

早过忘川 提交于 2019-11-28 02:52:04
问题 Is there a way to force arguments and parameters to one-line-each if a single or more character go past the overflow? For example: For example, this: if(value != "course" || value != "module" || value != "lesson" ) Should look like this: if(value != "course" || value != "module" || value != "lesson") Or this: if(value != "course" || value != "module" || value != "lesson") And this: void some_class::some_func(const std:string s, const std::string t ) Should look like this: void some_class: