Skip to content

Commit

Permalink
feat: Add support for Protocol Buffer text format (github-linguist/li…
Browse files Browse the repository at this point in the history
  • Loading branch information
kalkin committed May 17, 2022
1 parent b5d5486 commit 7a47a4c
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 1 deletion.
11 changes: 11 additions & 0 deletions languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4715,6 +4715,17 @@ Protocol Buffer:
codemirror_mode: protobuf
codemirror_mime_type: text/x-protobuf
language_id: 297
Protocol Buffer Text Format:
type: data
aliases:
- text proto
- protobuf text format
extensions:
- ".textproto"
- ".pbtxt"
tm_scope: source.textproto
ace_mode: text
language_id: 436568854
Public Key:
type: data
extensions:
Expand Down
2 changes: 1 addition & 1 deletion linguist
12 changes: 12 additions & 0 deletions src/linguist_aliases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,18 @@ lazy_static! {
"Protocol Buffers".to_string(),
"Protocol Buffer".to_string()
),
(
"protocol buffer text format".to_string(),
"Protocol Buffer Text Format".to_string()
),
(
"text proto".to_string(),
"Protocol Buffer Text Format".to_string()
),
(
"protobuf text format".to_string(),
"Protocol Buffer Text Format".to_string()
),
("public key".to_string(), "Public Key".to_string()),
("pug".to_string(), "Pug".to_string()),
("puppet".to_string(), "Puppet".to_string()),
Expand Down
8 changes: 8 additions & 0 deletions src/linguist_extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,14 @@ lazy_static! {
(".pml".to_string(), "Promela".to_string()),
(".spin".to_string(), "Propeller Spin".to_string()),
(".proto".to_string(), "Protocol Buffer".to_string()),
(
".textproto".to_string(),
"Protocol Buffer Text Format".to_string()
),
(
".pbtxt".to_string(),
"Protocol Buffer Text Format".to_string()
),
(".pub".to_string(), "Public Key".to_string()),
(".jade".to_string(), "Pug".to_string()),
(".pug".to_string(), "Pug".to_string()),
Expand Down
22 changes: 22 additions & 0 deletions tests/linguist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15918,6 +15918,28 @@ mod protocol_buffer {
}
}

mod protocol_buffer_text_format {
use file_expert::guess;
use file_expert::Guess;
use std::path::Path;

#[test]
fn test_0() {
let path = Path::new(&"./samples/Protocol Buffer Text Format/schema.pbtxt");
let actual = guess(&path).unwrap();
let expected = Guess::Kind("Protocol Buffer Text Format".to_string());
assert_eq!(actual, expected);
}

#[test]
fn test_1() {
let path = Path::new(&"./samples/Protocol Buffer Text Format/cudnn_benchmarks.textproto");
let actual = guess(&path).unwrap();
let expected = Guess::Kind("Protocol Buffer Text Format".to_string());
assert_eq!(actual, expected);
}
}

mod public_key {
use file_expert::guess;
use file_expert::Guess;
Expand Down

0 comments on commit 7a47a4c

Please # to comment.