Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format most ERB block open statements #57

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

pelletencate
Copy link

@pelletencate pelletencate commented Jul 4, 2024

Previously, whenever a block is being opened, we assume we can't format them because a SyntaxTree can't be established based on an unended block.

This PR attempts to resolve that for most blocks by doing the following:

  1. If it's a do block: assume you get a valid Ruby statement if you remove the terminating do or { and the parameter list
  2. If it's an if, unless, while or until block: assume you get a valid Ruby expression if you remove the first word (if/unless/while/until).

This will successfully format most blocks open statements.

Dependencies:

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.

1 participant