[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.
This commit is contained in:
Micha Reiser 2025-03-27 20:27:22 +01:00 committed by GitHub
parent 142fe0d29b
commit f9bc80ad55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -81,6 +81,7 @@ export default function Editor({
scrollBeyondLastLine: false, scrollBeyondLastLine: false,
contextmenu: false, contextmenu: false,
}} }}
language={fileName.endsWith(".pyi") ? "python" : undefined}
path={fileName} path={fileName}
wrapperProps={visible ? {} : { style: { display: "none" } }} wrapperProps={visible ? {} : { style: { display: "none" } }}
theme={theme === "light" ? "Ayu-Light" : "Ayu-Dark"} theme={theme === "light" ? "Ayu-Light" : "Ayu-Dark"}