[cfe-users] clang-format: Preserve horizontal whitespace?

Seth Cantrell seth.cantrell at gmail.com
Sat Jun 14 13:18:34 PDT 2014


There's no option for this at the moment. I believe what you'd really
want, however, is an option to automatically align variable
initializers similar to how certain comments get aligned.

> On Jun 14, 2014, at 3:59 PM, "Michael Wünsch" <liganic-clang at gmx.org> wrote:
>
> Hey everyone,
> I'm trying to get clang-format to preserve horizontal whitespace. For
> example:
>
> void main() {
>  int FOO       = 1;
>  int BAR       = 2;
>  int VERY_LONG = 3;
> }
>
> gets mushed into (using -style=Google as an example):
> void main() {
>  int FOO = 1;
>  int BAR = 2;
>  int VERY_LONG = 3;
> }
>
> The (Google) Styleguide
> (https://google-styleguide.googlecode.com/svn/trunk/cppguide.xml) says:
>
> "// Assignment operators always have spaces around them."
>
> This means at least one, not exactly one. clang-format however always
> consumes all horizontal whitespace and merges it into one space.
>
> Is there any way to fix this?
>
> Regards,
> --
> Michael
> _______________________________________________
> cfe-users mailing list
> cfe-users at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users




More information about the cfe-users mailing list