Skip to content

UI: Fix Dag code highlighting for triple-quoted and escaped-brace f-strings - #68026

Merged
bbovenzi merged 1 commit into
apache:mainfrom
Revanth14:dag-fstring-highlighting
Jun 4, 2026
Merged

bbovenzi merged 1 commit into
apache:mainfrom
Revanth14:dag-fstring-highlighting

Conversation

@Revanth14

Copy link
Copy Markdown
Contributor

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:
before

After:
after_fix

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?
  • Yes (Opus 4.8)

@bbovenzi bbovenzi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix.

@bbovenzi
bbovenzi merged commit dc27827 into apache:main Jun 4, 2026
83 checks passed
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Backport successfully created: v3-2-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
✅ v3-2-test PR Link

github-actions Bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Jun 4, 2026
(cherry picked from commit dc27827)

Co-authored-by: Revanth <revanthcse1@gmail.com>
aws-airflow-bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Jun 4, 2026
(cherry picked from commit dc27827)

Co-authored-by: Revanth <revanthcse1@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:UI Related to UI/UX. For Frontend Developers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DAG code syntax highlighting is incorrect with f-strings

3 participants