Modify foldEndPattern in Atom settings #161
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(This is in conjunction with a similar PR sent to
language-python
atom/language-python#274, though the text is modified slightly for MagicPython)Description of the Change
Add a value for
foldEndPattern
in the package settings. This improves the folding behavior for dictionaries, lists, and functions. It folds the entire logical syntax item instead of leaving the ending character on a separate line. It also improves the use of Hydrogen when the ending}
,)
, or]
is on a separate line and not indented.Many other core Atom language grammars have a
foldEndPattern
; the regex used in this PR is taken fromlanguage-javascript
because of the similarity in syntax used for data structures.Alternate Designs
The regex is
^\\s*\\}|^\\s*\\]|^\\s*\\)
in order to fold the end of dictionaries, lists, and functions/tuples, respectively.The current
foldEndPattern
in MagicPython is^\\s*"""\\s*$
. Thelanguage-python
foldEndPattern
used to be the same but was removed because the fold would include the beginning"""
here:Since Hydrogen uses Atom's fold regions to determine what code to send to the kernel, it also ran
"""
, which was undesirable.Benefits
Expanded:

Current fold behavior:

New fold behavior:

Current Hydrogen behavior with ending character on separate line:

New Hydrogen behavior with ending character on separate line:
Possible Drawbacks
Those who prefer the current behavior could be disappointed? I can't think of any others.
Applicable Issues