Skip to content

format comments with consistent spacing #4198

@macmoritz

Description

@macmoritz

Feature

Normally comments are started by a prefix, in protobuf it is //, followed by a space and the content.
Sadly buf format does not fixes missing or multiple spaces.
Sadly the space is not defined by the language guide but I think it is best practice to add a space. Therefor I am fine with an optional argument or config option.

Example

syntax = "proto3";

package test.v1;

//no space (incorrect)
// one space (correct)
//   multiple spaces (incorrect)
message TestMessage {}

Expected

Expected after buf format file.proto:

syntax = "proto3";

package test.v1;

// no space (incorrect)
// one space (correct)
// multiple spaces (incorrect)
message TestMessage {}

Any thoughts are welcome!

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions