Skip to content

Commit 7a47a4c

Browse files
committed
feat: Add support for Protocol Buffer text format (github-linguist/linguist#5716)
1 parent b5d5486 commit 7a47a4c

5 files changed

Lines changed: 54 additions & 1 deletion

File tree

languages.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4715,6 +4715,17 @@ Protocol Buffer:
47154715
codemirror_mode: protobuf
47164716
codemirror_mime_type: text/x-protobuf
47174717
language_id: 297
4718+
Protocol Buffer Text Format:
4719+
type: data
4720+
aliases:
4721+
- text proto
4722+
- protobuf text format
4723+
extensions:
4724+
- ".textproto"
4725+
- ".pbtxt"
4726+
tm_scope: source.textproto
4727+
ace_mode: text
4728+
language_id: 436568854
47184729
Public Key:
47194730
type: data
47204731
extensions:

linguist

src/linguist_aliases.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,18 @@ lazy_static! {
760760
"Protocol Buffers".to_string(),
761761
"Protocol Buffer".to_string()
762762
),
763+
(
764+
"protocol buffer text format".to_string(),
765+
"Protocol Buffer Text Format".to_string()
766+
),
767+
(
768+
"text proto".to_string(),
769+
"Protocol Buffer Text Format".to_string()
770+
),
771+
(
772+
"protobuf text format".to_string(),
773+
"Protocol Buffer Text Format".to_string()
774+
),
763775
("public key".to_string(), "Public Key".to_string()),
764776
("pug".to_string(), "Pug".to_string()),
765777
("puppet".to_string(), "Puppet".to_string()),

src/linguist_extensions.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,14 @@ lazy_static! {
753753
(".pml".to_string(), "Promela".to_string()),
754754
(".spin".to_string(), "Propeller Spin".to_string()),
755755
(".proto".to_string(), "Protocol Buffer".to_string()),
756+
(
757+
".textproto".to_string(),
758+
"Protocol Buffer Text Format".to_string()
759+
),
760+
(
761+
".pbtxt".to_string(),
762+
"Protocol Buffer Text Format".to_string()
763+
),
756764
(".pub".to_string(), "Public Key".to_string()),
757765
(".jade".to_string(), "Pug".to_string()),
758766
(".pug".to_string(), "Pug".to_string()),

tests/linguist.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15918,6 +15918,28 @@ mod protocol_buffer {
1591815918
}
1591915919
}
1592015920

15921+
mod protocol_buffer_text_format {
15922+
use file_expert::guess;
15923+
use file_expert::Guess;
15924+
use std::path::Path;
15925+
15926+
#[test]
15927+
fn test_0() {
15928+
let path = Path::new(&"./samples/Protocol Buffer Text Format/schema.pbtxt");
15929+
let actual = guess(&path).unwrap();
15930+
let expected = Guess::Kind("Protocol Buffer Text Format".to_string());
15931+
assert_eq!(actual, expected);
15932+
}
15933+
15934+
#[test]
15935+
fn test_1() {
15936+
let path = Path::new(&"./samples/Protocol Buffer Text Format/cudnn_benchmarks.textproto");
15937+
let actual = guess(&path).unwrap();
15938+
let expected = Guess::Kind("Protocol Buffer Text Format".to_string());
15939+
assert_eq!(actual, expected);
15940+
}
15941+
}
15942+
1592115943
mod public_key {
1592215944
use file_expert::guess;
1592315945
use file_expert::Guess;

0 commit comments

Comments
 (0)