bufbuild / buf

The best way of working with Protocol Buffers.
https://buf.build
Apache License 2.0
9.15k stars 277 forks source link

How can I change buf format setting to 4 spaces indent? #2412

Closed rinarakaki closed 1 year ago

bufdev commented 1 year ago

We don't support customization of the formatter - we believe that there should be exactly one way to format your Protobuf files, and any decision is better than no decision. As such, we went with 2 spaces, which is the majority usage for Protobuf as of now, and will stick with that. Apologies for the hassle.

rinarakaki commented 1 year ago

For example, Boston Dynamics API uses 4-space indentation in their protobuf definitions and they state so in their style guide:

QuantumGhost commented 1 year ago

We use tab for indentation in protobuf file. This allows every user choose their own indentation size while keeping all protobuf files consistent.

Forcing 2 spaces as indentation size for every user is not ideal. If you really want to make it "Zero configuration", I believe using tab is more appropriate. (same as what the Go team did)

bufdev commented 1 year ago

Our opinion is that you should switch to two spaces, which in our experience is what the majority of Protobuf APIs do, and help remove fragmentation in the community.

polRk commented 1 month ago

@bufdev What should developers who have vision problems and find it difficult to distinguish between two spaces do? Especially for large nested structures?