linguist icon indicating copy to clipboard operation
linguist copied to clipboard

Adding `txtpb` extension to Protocol Buffer Text Format

Open milesflo opened this issue 1 year ago β€’ 7 comments

Description

The Text Format specification has consolidated its canonical file extension to txtpb, with textproto still supported in some legacy tooling...

From the Docs:

.txtpb is the canonical text format file extension and should be preferred to the alternatives. This suffix is preferred for its brevity and consistency with the official wire-format file extension .binpb. The legacy canonical extension .textproto still has widespread usage and tooling support. Some tooling also supports the legacy extensions .textpb and .pbtxt. All other extensions besides the above are strongly discouraged; in particular, extensions such as .protoascii wrongly imply that text format is ascii-only, and others like .pb.txt are not recognized by common tooling. METADATA files are special text format proto files that lack any extension.

To Protocol Buffer Text Format:

Add Extensions

  • txtpb canonical extension by the standard

Checklist:

  • [x] I am adding a new extension to a language.
    • [ ] The new extension is used in hundreds of repositories on GitHub.com
      • Search results for each extension:
        • https://github.com/search?type=code&q=NOT+is%3Afork+path%3A*.txtpb
    • [x] I have included a real-world usage sample for all extensions added in this PR:
    • [ ] I have included a change to the heuristics to distinguish my language from others using the same extension.

milesflo avatar Oct 05 '23 18:10 milesflo

@lildude Squashed change & comment updated πŸ‘

milesflo avatar Oct 05 '23 19:10 milesflo

We still need a sample for the new extension.

Ahh I see. Done: https://github.com/github-linguist/linguist/pull/6566/commits/0fc370705d76fccd898e74384635b821d352042b

milesflo avatar Oct 05 '23 20:10 milesflo

Thanks but as stated in the CONTRIBUTING.md file, the sample should be a real world sample. This appears to be a contrived "hello world" like sample. We also need to know the source of the sample and the license of the file. This was a point in the template you removed when opening this PR, which brings me to that port, please put back the template and fill it in… it's there for a reason πŸ˜‰

lildude avatar Oct 06 '23 07:10 lildude

@lildude Updated the sample, readded the template, and added links to everything

milesflo avatar Oct 09 '23 19:10 milesflo

Would it be possible to have an exception for the "pending popularity" requirement?

At least within our org (https://github.com/qh-lab), the only reason we didn't use .txtpb is because linguist doesn't highlight it. I'm sure other orgs/repos had the same thought.

dougthor42 avatar Jan 04 '24 16:01 dougthor42

Would it be possible to have an exception for the "pending popularity" requirement?

Unfortunately we can't as it sets a precedent we don't want to fight each and every time someone develops "the next greatest thing, promise on my hamster's life".

As Linguist already knows about the language, you can use an override to set the language until this PR is merged and deployed.

lildude avatar Jan 04 '24 16:01 lildude

I am disappointed, but completely understand and agree. But I had to try :wink:.

Also, good to know about overrides! I'll let our team know. Thanks!

dougthor42 avatar Jan 04 '24 18:01 dougthor42