From f9bc80ad55576d65df9811353be6d081c9f72fff Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Thu, 27 Mar 2025 20:27:22 +0100 Subject: [PATCH] [red-knot] Fix syntax highlighting for pyi files (#17015) Monaco supports inferring the language based on the file's extension but it doesn't seem to support `pyi`. I tried to patch up the python language definition by adding `.pyi` to the language's `extension` array but that didn't work. That's why I decided to patch up the language in React. --- playground/knot/src/Editor/Editor.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/playground/knot/src/Editor/Editor.tsx b/playground/knot/src/Editor/Editor.tsx index 15f4089f27..4f362fe674 100644 --- a/playground/knot/src/Editor/Editor.tsx +++ b/playground/knot/src/Editor/Editor.tsx @@ -81,6 +81,7 @@ export default function Editor({ scrollBeyondLastLine: false, contextmenu: false, }} + language={fileName.endsWith(".pyi") ? "python" : undefined} path={fileName} wrapperProps={visible ? {} : { style: { display: "none" } }} theme={theme === "light" ? "Ayu-Light" : "Ayu-Dark"}