Revanth14 opened a new pull request, #68026:
URL: https://github.com/apache/airflow/pull/68026
---
Fixes #67986
Supersedes #67997 by fixing the triple-quoted f-string tokenizer state, not
only escaped braces in existing f-string states.
Fix Dag code syntax highlighting for triple-quoted Python f-strings that
contain escaped braces, such as Jinja templates written as `{{{{ ds }}}}`.
Root cause: Monaco's bundled Python tokenizer routes triple-quoted f-strings
through single-line f-string states and mishandles escaped braces, causing
highlighting to leak past the closing triple quote.
This change registers Python with a patched Monarch grammar for the Airflow
UI's Monaco editor and adds regression coverage using Monaco's real tokenizer.
Before:
<img width="1498" height="870" alt="before"
src="https://github.com/user-attachments/assets/9b48199d-393f-41a0-9de2-f741e9cfd493"
/>
After:
<img width="807" height="569" alt="after_fix"
src="https://github.com/user-attachments/assets/b21ef463-d96c-486d-935c-37dc35dee11d"
/>
Tests:
- `pnpm test src/components/MonacoEditor/pythonFStrings.test.ts`
- `pnpm exec eslint src/components/MonacoEditor/pythonFStrings.ts
src/components/MonacoEditor/pythonFStrings.test.ts
src/components/MonacoEditor/configureMonaco.ts src/vite-env.d.ts`
- `pnpm exec prettier --check src/components/MonacoEditor/pythonFStrings.ts
src/components/MonacoEditor/pythonFStrings.test.ts
src/components/MonacoEditor/configureMonaco.ts src/vite-env.d.ts`
- `pnpm exec tsc --p tsconfig.app.json --noEmit`
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (Opus 4.8)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]