Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issues with DotProto.Rendering #75

Open
joshsh opened this issue Aug 1, 2018 · 2 comments
Open

issues with DotProto.Rendering #75

joshsh opened this issue Aug 1, 2018 · 2 comments

Comments

@joshsh
Copy link

joshsh commented Aug 1, 2018

The following is a collection of apparent issues DotProto.Rendering and DotProto.AST which are making it hard to generate *.proto files which are valid and readable.

Indentation

Messages are formatted like this:

message Aircraft { string tailNumber = 1; // The aircraft's registration number
                 }

whereas they should be formatted more like this:

message Aircraft {
  string tailNumber = 1; // The aircraft's registration number
}

Multiline comments

Field-level comments with line breaks come out wrong. E.g. a three-line comment on the tailNumber field currently looks like this (resulting in an invalid *.proto file):

message Aircraft { string tailNumber = 1; // First line of comment
Second line of comment
Third line of comment
                 }

The suffix-style comments also have the problem that long lines extend outside of an 80-char buffer. Can we just use block comments everywhere? E.g.

message Aircraft {
  /*
   * First line of comment
   * Second line of comment
   * Third line of comment
   */
  string tailNumber = 1;
}

Double-newlines for readability

The generated *.proto files currently insert at most one newline between subsequent headers and definitions. It would improve readability if an additional newline were inserted. For example, in:

syntax = "proto3";
package time;
import "./basic.proto";
enum DayOfWeek {SUNDAY = 0;
                MONDAY = 1;
                TUESDAY = 2;
                WEDNESDAY = 3;
                THURSDAY = 4;
                FRIDAY = 5;
                SATURDAY = 6;}

DotProtoDefinition-level comments?

DotProtoField allows a comment. What about DotProtoDefinition (for message, enum, and service definitions)? Am I missing something?

@joshsh
Copy link
Author

joshsh commented Dec 4, 2018

Btw. I have created an improved pretty printer in the meantime. This could be contributed as a diff if it is of interest. It replaces the current printer.

@Gabriella439
Copy link
Contributor

@joshsh: Definitely! Please open a pull request 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants