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

Add 'print_message_fields_in_index_order' option to text formatter #133

Open
bouk opened this issue Nov 19, 2024 · 3 comments
Open

Add 'print_message_fields_in_index_order' option to text formatter #133

bouk opened this issue Nov 19, 2024 · 3 comments

Comments

@bouk
Copy link
Contributor

bouk commented Nov 19, 2024

Just like the C++ printer. I'll let the comment explain what it does:

// If print_message_fields_in_index_order is true, fields of a proto message
// will be printed using the order defined in source code instead of the
// field number, extensions will be printed at the end of the message
// and their relative order is determined by the extension number.
// By default, use the field number order.
@andrewhickman
Copy link
Owner

Do you have a particular usecase for this option? I'd like to avoid supporting too many formatting options if possible

@bouk
Copy link
Contributor Author

bouk commented Nov 29, 2024

I'm working on an editor for protobuf files and I want to have the order of the fields match the order in the proto definition, purely for aesthetic reasons.

@andrewhickman
Copy link
Owner

andrewhickman commented Dec 3, 2024

I'd accept a PR to implement this, so long as it doesn't require any extra work when building the DescriptorPool to track the ordering. Hopefully it can be implemented using the original descriptor_proto

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