atom / language-python

Python package for Atom
Other
190 stars 146 forks source link

Allow folding if statement without elif or else #300

Closed Ben3eeE closed 5 years ago

Ben3eeE commented 5 years ago

Requirements

Description of the Change

The changes introduced in https://github.com/atom/language-python/pull/292 made it impossible to fold an if_statement without an elif_clause and/or else_clause. This PR fixes this by adding back if_statement to the fold rules and rearranges the rules so the rule that ends with elif_clause and else_clause types take precedence.

Before: image

After: image

Alternate Designs

No

Benefits

Can fold lonely if statements again

Possible Drawbacks

No

Applicable Issues

Folding part of https://github.com/atom/language-python/issues/299

/cc: @daviwil FYI