In JavaScript code like { foo: bar }
, is there any way to make clang-format preserve the spaces just inside the braces?
I’ve studied the clang-format docs pretty carefully and the closest is SpacesInContainerLiterals
, but that’ll only put spaces inside brackets, like [ 1, 2 ]
(also my requirement) but removes spaces inside braces. (That config also adds spaces around colons inside braces, which I can’t have).
Ahmed Fasih is only partially correct. This option (Cpp11BracedListStyle: false
) does not seem to work 100% of the time for import statements.
// input
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
// output
import {Component, OnDestroy, OnInit, ViewEncapsulation} from '@angular/core';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With