File tree Expand file tree Collapse file tree 4 files changed +8
-3
lines changed
Expand file tree Collapse file tree 4 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ to format C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code.
5454 Objective-C: .m .mm
5555 Proto: .proto .protodevel
5656 TableGen: .td
57- TextProto: .textpb .pb.txt .textproto .asciipb
57+ TextProto: .txtpb . textpb .pb.txt .textproto .asciipb
5858 Verilog: .sv .svh .v .vh
5959 --cursor=<uint> - The position of the cursor when invoking
6060 clang-format from an editor integration
Original file line number Diff line number Diff line change @@ -3891,7 +3891,11 @@ static FormatStyle::LanguageKind getLanguageByFileName(StringRef FileName) {
38913891 FileName.ends_with_insensitive (" .protodevel" )) {
38923892 return FormatStyle::LK_Proto;
38933893 }
3894- if (FileName.ends_with_insensitive (" .textpb" ) ||
3894+ // txtpb is the canonical extension, and textproto is the legacy canonical
3895+ // extension
3896+ // https://protobuf.dev/reference/protobuf/textformat-spec/#text-format-files
3897+ if (FileName.ends_with_insensitive (" .txtpb" ) ||
3898+ FileName.ends_with_insensitive (" .textpb" ) ||
38953899 FileName.ends_with_insensitive (" .pb.txt" ) ||
38963900 FileName.ends_with_insensitive (" .textproto" ) ||
38973901 FileName.ends_with_insensitive (" .asciipb" )) {
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ config.suffixes = [
1212 " .proto" ,
1313 " .protodevel" ,
1414 " .pb.txt" ,
15+ " .txtpb" ,
1516 " .textproto" ,
1617 " .textpb" ,
1718 " .asciipb" ,
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ static cl::opt<std::string> AssumeFileName(
9292 " Objective-C: .m .mm\n "
9393 " Proto: .proto .protodevel\n "
9494 " TableGen: .td\n "
95- " TextProto: .textpb .pb.txt .textproto .asciipb\n "
95+ " TextProto: .txtpb . textpb .pb.txt .textproto .asciipb\n "
9696 " Verilog: .sv .svh .v .vh" ),
9797 cl::init(" <stdin>" ), cl::cat(ClangFormatCategory));
9898
You can’t perform that action at this time.
0 commit comments