[clang] Treat ipynb as json (PR #135137)

via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 9 23:55:04 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-format

Author: Tim Clephas (Timple)

<details>
<summary>Changes</summary>

Fixes #<!-- -->110727

I do not have merge access on this repository. So please merge if approved.

---
Full diff: https://github.com/llvm/llvm-project/pull/135137.diff


1 Files Affected:

- (modified) clang/lib/Format/Format.cpp (+3-1) 


``````````diff
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index eec5cc8632168..b90bd8276e1e2 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -4086,8 +4086,10 @@ static FormatStyle::LanguageKind getLanguageByFileName(StringRef FileName) {
     return FormatStyle::LK_TableGen;
   if (FileName.ends_with_insensitive(".cs"))
     return FormatStyle::LK_CSharp;
-  if (FileName.ends_with_insensitive(".json"))
+  if (FileName.ends_with_insensitive(".json") ||
+      FileName.ends_with_insensitive(".ipynb")) {
     return FormatStyle::LK_Json;
+  }
   if (FileName.ends_with_insensitive(".sv") ||
       FileName.ends_with_insensitive(".svh") ||
       FileName.ends_with_insensitive(".v") ||

``````````

</details>


https://github.com/llvm/llvm-project/pull/135137


More information about the cfe-commits mailing list