[PATCH] clang-format: Recognize .ts files as JavaScript (TypeScript is a dialect of JavaScript).

Martin Probst martinprobst at google.com
Mon Mar 9 19:17:25 PDT 2015


Hi djasper,

http://reviews.llvm.org/D8190

Files:
  lib/Format/Format.cpp

Index: lib/Format/Format.cpp
===================================================================
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -1528,7 +1528,8 @@
 static FormatStyle::LanguageKind getLanguageByFileName(StringRef FileName) {
   if (FileName.endswith(".java")) {
     return FormatStyle::LK_Java;
-  } else if (FileName.endswith_lower(".js")) {
+  } else if (FileName.endswith_lower(".js") || FileName.endswith_lower(".ts")) {
+    // JavaScript or TypeScript.
     return FormatStyle::LK_JavaScript;
   } else if (FileName.endswith_lower(".proto") ||
              FileName.endswith_lower(".protodevel")) {

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8190.21542.patch
Type: text/x-patch
Size: 631 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150310/8c9d7bda/attachment.bin>


More information about the cfe-commits mailing list