bufbuild / buf

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

buf format: comment whitespace is still a little wonky #1839

Closed jrouly closed 1 year ago

jrouly commented 1 year ago

Hi,

We've noticed that when upgrading buf from 1.8 to 1.9 (as documented in https://github.com/bufbuild/buf/issues/1612), whitespace behavior in multiline comment blocks changed.

It was addressed in 1.10 (per https://github.com/bufbuild/buf/pull/1615) but it looks like there are still persistent issues with multiline comment formatting.

For example, on 1.14, we're seeing this diff introduced in our protobuf:

 /*
- * Information that is associated with a vulnerability network that we need to be able to store,
- * filter, search, and then obtain for use.
- */
+   * Information that is associated with a vulnerability network that we need to be able to store,
+   * filter, search, and then obtain for use.
+*/
 message Asset {
   /*
-   * Meta information about the asset that can be used to identify and categorize the asset.
-   */
+     * Meta information about the asset that can be used to identify and categorize the asset.
+  */
   message Info {
     string id = 1;
     string name = 2;
     optional string description = 3;
     bool stable = 4;
     optional string context = 5;
     string type = 6;
   }

which really just looks....wonky. Here's a side-by-side comparison.

before (buf 1.7):

/*
 * Information that is associated with a vulnerability network that we need to be able to store,
 * filter, search, and then obtain for use.
 */
message Asset {
  /*
   * Meta information about the asset that can be used to identify and categorize the asset.
   */
  message Info {
    string id = 1;
    string name = 2;
    optional string description = 3;
    bool stable = 4;
    optional string context = 5;
    string type = 6;
  }

after (buf 1.8):

/*
   * Information that is associated with a vulnerability network that we need to be able to store,
   * filter, search, and then obtain for use.
*/
message Asset {
  /*
     * Meta information about the asset that can be used to identify and categorize the asset.
  */
  message Info {
    string id = 1;
    string name = 2;
    optional string description = 3;
    bool stable = 4;
    optional string context = 5;
    string type = 6;
  }
noorul commented 1 year ago

This is annoying. Can this be fixed soon?