From bdacf08b8682b9fbe3a8656a53b1f8b1cb007fd8 Mon Sep 17 00:00:00 2001 From: Xuehai Pan Date: Mon, 7 Jul 2025 11:43:31 +0800 Subject: [PATCH] [BE][Easy] add `.editorconfig` setting for C/C++/CUDA/ObjC (#157692) Pull Request resolved: https://github.com/pytorch/pytorch/pull/157692 Approved by: https://github.com/ezyang --- .clang-format | 1 + .editorconfig | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index 2e5161504103..67b722d967c7 100644 --- a/.clang-format +++ b/.clang-format @@ -120,6 +120,7 @@ UseTab: Never Language: ObjC ColumnLimit: 120 AlignAfterOpenBracket: Align +IndentWidth: 2 ObjCBlockIndentWidth: 2 ObjCSpaceAfterProperty: false ObjCSpaceBeforeProtocolList: false diff --git a/.editorconfig b/.editorconfig index 74c90164422d..5b03a1a2fb51 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,14 +1,30 @@ root = true [*] +charset = utf-8 end_of_line = lf insert_final_newline = true # Python -[*.py] +[*.{py,pyi,py.in,pyi.in}] indent_style = space indent_size = 4 +# C/C++/CUDA +[*.{cpp,hpp,cxx,cc,c,h,cu,cuh}] +indent_style = space +indent_size = 2 + +# Objective-C +[*.{mm,m,M}] +indent_style = space +indent_size = 2 + +# Clang tools +[.clang-{format,tidy}] +indent_style = space +indent_size = 2 + # Make [Makefile] indent_style = tab