[clang] Add `.cjs` extension handling for JavaScript Language. (PR #118188)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Nov 30 18:13:44 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-format
Author: Jim B (d3x0r)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/118188.diff
1 Files Affected:
- (modified) clang/lib/Format/Format.cpp (+1)
``````````diff
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.
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/118188
More information about the cfe-commits
mailing list