Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/docs/ClangFormat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ to format C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code.
supported:
CSharp: .cs
Java: .java
JavaScript: .mjs .js .ts
JavaScript: .mjs .js .ts .cjs
Json: .json
Objective-C: .m .mm
Proto: .proto .protodevel
Expand Down
1 change: 1 addition & 0 deletions clang/lib/Format/Format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3950,6 +3950,7 @@ static FormatStyle::LanguageKind getLanguageByFileName(StringRef FileName) {
return FormatStyle::LK_Java;
if (FileName.ends_with_insensitive(".js") ||
FileName.ends_with_insensitive(".mjs") ||
FileName.ends_with_insensitive(".cjs") ||
FileName.ends_with_insensitive(".ts")) {
return FormatStyle::LK_JavaScript; // (module) JavaScript or TypeScript.
}
Expand Down
2 changes: 1 addition & 1 deletion clang/tools/clang-format/ClangFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static cl::opt<std::string> AssumeFileName(
"supported:\n"
" CSharp: .cs\n"
" Java: .java\n"
" JavaScript: .mjs .js .ts\n"
" JavaScript: .cjs .mjs .js .ts\n"
" Json: .json\n"
" Objective-C: .m .mm\n"
" Proto: .proto .protodevel\n"
Expand Down
2 changes: 1 addition & 1 deletion clang/tools/clang-format/git-clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def main():
# Other languages that clang-format supports
'proto', 'protodevel', # Protocol Buffers
'java', # Java
'mjs', 'js', # JavaScript
'cjs', 'mjs', 'js', # JavaScript
'ts', # TypeScript
'cs', # C Sharp
'json', # Json
Expand Down