clang-format: Recognize the .ts (TypeScript) extension as JavaScript.

Patch by Martin Probst. Thank you.

llvm-svn: 231926
This commit is contained in:
Daniel Jasper 2015-03-11 14:58:38 +00:00
parent 580defbbae
commit 8c68a64ec8
2 changed files with 3 additions and 2 deletions

View File

@ -1528,7 +1528,8 @@ const char *StyleOptionHelpDescription =
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")) {

View File

@ -48,7 +48,7 @@ def main():
help='custom pattern selecting file paths to reformat '
'(case sensitive, overrides -iregex)')
parser.add_argument('-iregex', metavar='PATTERN', default=
r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hpp|m|mm|inc|js|proto'
r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hpp|m|mm|inc|js|ts|proto'
r'|protodevel|java)',
help='custom pattern selecting file paths to reformat '
'(case insensitive, overridden by -regex)')