aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorJim B <d3x0r@users.noreply.github.com>2024-12-03 12:03:51 -0500
committerGitHub <noreply@github.com>2024-12-03 09:03:51 -0800
commit56ab56c85729976f29d5de2fd73912449cb6da7c (patch)
tree42270ba679633ab8fbcea5b6ebdee4285afe6dc7 /clang/lib/Format/Format.cpp
parent68112f0f5b2209e14aae9a891481cba5709873a2 (diff)
downloadllvm-56ab56c85729976f29d5de2fd73912449cb6da7c.zip
llvm-56ab56c85729976f29d5de2fd73912449cb6da7c.tar.gz
llvm-56ab56c85729976f29d5de2fd73912449cb6da7c.tar.bz2
[clang-format] Add support for `.cjs` as JavaScript file extension (#118188)
Node uses `.cjs` as an extension for 'common javascript' modules.
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r--clang/lib/Format/Format.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index ee52972..dcaac4b 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.
}