bat icon indicating copy to clipboard operation
bat copied to clipboard

Syntax highlighting for `textproto`

Open vorburger opened this issue 1 year ago • 4 comments

bat already digs .proto (which is the schema language of https://protobuf.dev).

.textproto is a file format for representation of protobuf data in text format, see https://protobuf.dev/reference/protobuf/textformat-spec/.

The goal of this issue would be to add syntax highlighting support for that format.

I dunno if e.g. https://github.com/VcamX/protobuf-syntax-highlighting could be helpful for someone interested to implement this.

vorburger avatar Apr 14 '23 16:04 vorburger

Text proto is already supported, but not with the .textproto extension:

$ bat -L | grep 'Protocol Buffer (TEXT)'
Protocol Buffer (TEXT):pb.txt,proto.text,textpb,pbtxt,prototxt

I created https://github.com/VcamX/protobuf-syntax-highlighting/pull/11 to add support for it in the underlying syntax spec.

bluec0re avatar Apr 18 '23 08:04 bluec0re

Update: the change just got merged: https://github.com/VcamX/protobuf-syntax-highlighting/commit/1365331580b0e4bb86f74d0c599dccc87e7bdacb

bluec0re avatar Aug 16 '23 08:08 bluec0re

@bluec0re cool, thanks! However this doesn't seem to work on v0.24.0 released on Oct 11, 2023 (after your PR above from August).

I suspected that some version may have to be bumped, but this looks like it's just pulling master (as a sob-module), so not sure what's "missing".

$  bat --version
bat 0.24.0

$  bat -L | grep 'Protocol Buffer (TEXT)'
Protocol Buffer (TEXT):pb.txt,proto.text,textpb,pbtxt,prototxt

vorburger avatar Apr 09 '24 18:04 vorburger

Hm, indeed... didn't notice as I added the textproto extension to my config file:

--map-syntax "*.textproto:Protocol Buffer (TEXT)"

But the commit needs to be bumped in this repository as well: https://github.com/sharkdp/bat/tree/master/assets/syntaxes/02_Extra/Protobuf still points to 726e21d

bluec0re avatar Apr 12 '24 19:04 bluec0re

But the commit needs to be bumped in this repository as well: https://github.com/sharkdp/bat/tree/master/assets/syntaxes/02_Extra/Protobuf still points to 726e21d

@bluec0re #3038 should do the trick. (Or #3039.)

vorburger avatar Jul 21 '24 21:07 vorburger