https://github.com/d3x0r updated https://github.com/llvm/llvm-project/pull/118188
>From 8ce527dc2cc7ac285f782648838664491abffc30 Mon Sep 17 00:00:00 2001 From: d3x0r <d3...@no-reply.github.com> Date: Sat, 30 Nov 2024 02:32:40 -0800 Subject: [PATCH 1/2] Add *.cjs handling for JavaScript Language. --- clang/lib/Format/Format.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index ee52972ce66f4a..dcaac4b0d42cc5 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -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. } >From 3f28f82d1dc87006aceb0e0c7bd95c460d70ccd0 Mon Sep 17 00:00:00 2001 From: d3x0r <d3...@no-reply.github.com> Date: Sun, 1 Dec 2024 13:04:01 -0800 Subject: [PATCH 2/2] Also update docs, command line help info, git-clang-format --- clang/docs/ClangFormat.rst | 2 +- clang/tools/clang-format/ClangFormat.cpp | 2 +- clang/tools/clang-format/git-clang-format | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/docs/ClangFormat.rst b/clang/docs/ClangFormat.rst index e17d741b0a00eb..10ddca8685e941 100644 --- a/clang/docs/ClangFormat.rst +++ b/clang/docs/ClangFormat.rst @@ -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 diff --git a/clang/tools/clang-format/ClangFormat.cpp b/clang/tools/clang-format/ClangFormat.cpp index 5481bb6b87503c..a3e80964c68028 100644 --- a/clang/tools/clang-format/ClangFormat.cpp +++ b/clang/tools/clang-format/ClangFormat.cpp @@ -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" diff --git a/clang/tools/clang-format/git-clang-format b/clang/tools/clang-format/git-clang-format index 6a2a2a22ec5c2b..f965adae42f435 100755 --- a/clang/tools/clang-format/git-clang-format +++ b/clang/tools/clang-format/git-clang-format @@ -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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits