[PATCH] D66584: [clang-format] Support .mjs module javascript extension in clang-format
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 22 21:45:25 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369732: [clang-format] Recognize ECMAScript module .mjs as JavaScript (authored by MaskRay, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D66584?vs=216588&id=216766#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66584/new/
https://reviews.llvm.org/D66584
Files:
cfe/trunk/lib/Format/Format.cpp
Index: cfe/trunk/lib/Format/Format.cpp
===================================================================
--- cfe/trunk/lib/Format/Format.cpp
+++ cfe/trunk/lib/Format/Format.cpp
@@ -2411,8 +2411,9 @@
static FormatStyle::LanguageKind getLanguageByFileName(StringRef FileName) {
if (FileName.endswith(".java"))
return FormatStyle::LK_Java;
- if (FileName.endswith_lower(".js") || FileName.endswith_lower(".ts"))
- return FormatStyle::LK_JavaScript; // JavaScript or TypeScript.
+ if (FileName.endswith_lower(".js") || FileName.endswith_lower(".mjs") ||
+ FileName.endswith_lower(".ts"))
+ return FormatStyle::LK_JavaScript; // (module) JavaScript or TypeScript.
if (FileName.endswith(".m") || FileName.endswith(".mm"))
return FormatStyle::LK_ObjC;
if (FileName.endswith_lower(".proto") ||
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66584.216766.patch
Type: text/x-patch
Size: 821 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190823/0f93a154/attachment.bin>
More information about the cfe-commits
mailing list