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

Tim Clephas via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 9 23:54:12 PDT 2025


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

Fixes #110727

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

>From a924a68f906a14ee479b547658f6633328427ecd Mon Sep 17 00:00:00 2001
From: Tim Clephas <tim.clephas at nobleo.nl>
Date: Thu, 10 Apr 2025 08:53:20 +0200
Subject: [PATCH] Treat ipynb as json

Fixes #110727
---
 clang/lib/Format/Format.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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") ||



More information about the cfe-commits mailing list