Skip to content

fix(macros): support availability attributes on previews - #1105

Merged
Kyle-Ye merged 1 commit into
mainfrom
bugfix/preview_macro
Sep 27, 2026
Merged

Kyle-Ye merged 1 commit into
mainfrom
bugfix/preview_macro

Conversation

@Kyle-Ye

@Kyle-Ye Kyle-Ye commented Sep 27, 2026

Copy link
Copy Markdown
Member

Summary

  • Register previews at the #Preview token so availability attributes do not shift their source location.
  • Format generated preview closures before registry insertion to avoid extra indentation.
  • Add regression tests for attributes before and on the same line as #Preview.

All 16 macro expansion tests pass.

@github-actions github-actions Bot added area: tests Test suites, UI tests, fixtures, snapshots, and test support code. area: tooling Developer tooling, package manifests, Tuist, scripts, formatting, or release tooling. type: bug Something is not working correctly. labels Sep 27, 2026
@tuist

tuist Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

🛠️ Tuist Run Report 🛠️

Tests 🧪

Scheme Status Ran test modules Commit
OpenSwiftUI ✅ 7 25f1071bc

Builds 🔨

Scheme Status Duration Commit
OpenSwiftUI ✅ 1m 9s 25f1071bc

@codecov

codecov Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 33.26%. Comparing base (b90679e) to head (9d29694).

Files with missing lines Patch % Lines
Sources/OpenSwiftUIMacros/PreviewMacro.swift 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1105   +/-   ##
=======================================
  Coverage   33.26%   33.26%           
=======================================
  Files         805      805           
  Lines       63992    63992           
=======================================
+ Hits        21288    21290    +2     
+ Misses      42704    42702    -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Kyle-Ye
Kyle-Ye merged commit 5448ac1 into main Sep 27, 2026
6 checks passed
@Kyle-Ye
Kyle-Ye deleted the bugfix/preview_macro branch September 27, 2026 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tests Test suites, UI tests, fixtures, snapshots, and test support code. area: tooling Developer tooling, package manifests, Tuist, scripts, formatting, or release tooling. type: bug Something is not working correctly.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant