Skip to content

feat(editor): highlight XAML files as XML - #16530

Closed
psh4607 wants to merge 1 commit into
stablyai:mainfrom
psh4607:feat/xaml-syntax-highlighting
Closed

psh4607 wants to merge 1 commit into
stablyai:mainfrom
psh4607:feat/xaml-syntax-highlighting

Conversation

@psh4607

@psh4607 psh4607 commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Orca currently opens XAML files as plain text. This teaches the editor to treat .xaml files as XML so Monaco's built-in XML highlighting can color their tags, attributes, values, and comments.

What Changed

  • Map .xaml to Monaco's built-in xml language id.
  • Cover a normal XAML path and a case-insensitive Windows path with a focused regression test.

Why

XAML is XML, so the existing built-in XML support provides useful highlighting without adding a grammar, dependency, icon mapping, or language registration.

Linked Issue

Fixes #16396

Visual Proof

Rendered Electron QA passed through the repository's Playwright Electron fixture:

  • Opened a real MainWindow.xaml from Orca's File Explorer.
  • Confirmed the active Monaco model language is xml.
  • Confirmed Monaco rendered six distinct token styles across XAML element names, attributes, values, and comments.
  • Captured and visually inspected the screenshot below.
orca-xaml-syntax-highlighting

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below
  • pnpm lint — passed
  • pnpm typecheck — passed
  • Full pnpm test — 60,979 passed and 248 skipped, with one unrelated interactive-zsh portability test failing under full-suite load; the exact file passes when focused
  • pnpm build — passed

Validated on macOS with Node 24.18.0 and pnpm 10.24.0:

  • pnpm test src/renderer/src/lib/language-detect.test.ts — 16 tests passed.
  • pnpm tc:web — passed.
  • pnpm run check:code-quality:changed — passed with 0 new findings across 2 changed files.
  • Repository Playwright Electron QA — 1 test passed in 24.0s; Monaco language xml, six distinct token styles.
  • Clean full-suite run with HISTFILE unset, ZDOTDIR=/var/empty, and --maxWorkers=2 — 6,546 files passed, 42 skipped, and 1 unrelated file failed; 60,979 tests passed, 248 skipped, and 1 failed. The prior Electron H3 egress timeout did not recur.
  • Focused rerun of src/shared/startup-shell-portability.live-shell.test.ts — 171 passed and 16 skipped, including the exact zsh case that failed in the full run.
  • A reduced --maxWorkers=1 diagnostic rerun stalled in the same interactive zsh case; a process stack sample showed /bin/zsh -i waiting for input in ZLE, so the run was stopped rather than reported as passing.

The remaining full-suite failure is isolated from this PR's two language-detection files, and no unrelated source change was made.

Windows behavior was covered by the case-insensitive C:\\...\\MAINWINDOW.XAML regression path; Windows, Linux, and SSH were not manually tested.

AI Disclosure

OpenAI Codex was used for implementation, validation, and PR preparation under user direction.

Review

Ready for maintainer review.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • This is a renderer-only extension mapping. It does not change remote wire behavior, SSH execution, mobile behavior, security boundaries, or runtime performance.
  • feat(editor): add OCaml and MLX syntax highlighting #16421 also edits the two language-detection files for unrelated OCaml support, but its hunks are disjoint and this PR includes none of that scope.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@psh4607
psh4607 marked this pull request as ready for review August 26, 2026 02:58
@coderabbitai

coderabbitai Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1f7b0ab6-5dc2-47d3-8801-c7ae275dfcb7

📥 Commits

Reviewing files that changed from the base of the PR and between 5a8b4af and 896cafb.

📒 Files selected for processing (2)
  • src/renderer/src/lib/language-detect.test.ts
  • src/renderer/src/lib/language-detect.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The language detector now maps .xaml files to Monaco’s xml language ID. Tests verify case-insensitive matching for Unix-style and Windows paths.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The implementation satisfies issue #16396 by mapping .xaml files to Monaco's xml language and adding regression tests for normal and case-insensitive Windows paths.
Out of Scope Changes check ✅ Passed The changes are limited to the language mapping and focused regression tests. No unrelated code or scope is included.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Title check ✅ Passed The title clearly and concisely describes the primary change: mapping XAML files to XML syntax highlighting.
Description check ✅ Passed The description is complete and focused. It explains the change and reason, links issue #16396, documents visual validation, lists tests and known unrelated failures, includes AI disclosure, and addre…
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.

Full details: Description check

Explanation

The description is complete and focused. It explains the change and reason, links issue #16396, documents visual validation, lists tests and known unrelated failures, includes AI disclosure, and addresses scope and compatibility. The visual proof includes one screenshot rather than the requested before-and-after pair, and the full test suite has one documented unrelated failure.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker

Copy link
Copy Markdown
Contributor

Thank you @psh4607 for implementing the XAML mapping and covering the uppercase Windows path, and @smaucy for reporting it in #16396.

Merged #23371 now recognizes every filename association already bundled with Monaco, including .xaml → xml. I verified both regression cases from this PR against that change (src/App.xaml and C:\repo\Views\MAINWINDOW.XAML); both resolve to xml. All applicable CI checks passed before merge.

Closing this PR as superseded by the general solution, with credit to your contribution recorded in #23371. No additional XAML-specific table row is needed. This provides XML highlighting; richer coloring inside XAML markup extensions remains separate future work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: syntax highlighting for .xaml files (WPF/MAUI)

2 participants