Skip to content

adding printVariant function to skip printing the variant node when possible#1251

Merged
Janther merged 1 commit intomainfrom
print-variant-helper
Sep 13, 2025
Merged

adding printVariant function to skip printing the variant node when possible#1251
Janther merged 1 commit intomainfrom
print-variant-helper

Conversation

@Janther
Copy link
Copy Markdown
Member

@Janther Janther commented Sep 2, 2025

prettier's print function on variants executes extra steps preparing the plugin's print function print comments and checking the position of the cursor in regards to the current node.

since we don't to repeat these steps another time when printing a polymorphic node which only delegates the printing to the variant, we simply avoid printing unless there's a comment attached to the polymorphic node.

@Janther Janther requested a review from fvictorio September 2, 2025 21:36
@Janther Janther force-pushed the print-variant-helper branch from 0eec671 to cd4932f Compare September 13, 2025 18:00
@Janther Janther merged commit a4a3fee into main Sep 13, 2025
7 checks passed
@Janther Janther deleted the print-variant-helper branch September 13, 2025 18:02
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.

2 participants