Add foldEndPattern to settings to improve folding and Hydrogen selections #163
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.
(I sent similar PRs to the
language-python
atom/language-python#274, and MagicPython MagicStack/MagicPython#161 syntax highlighters)Note: I don't understand Julia's syntax too well, so the exact regular expression used in
foldEndPattern
is subject to debate. Regardless, this addition would serve Hydrogen+IJulia users.Description of the Change
Add a value for
foldEndPattern
in the package settings. The regex used is^\\s*\\]|^\\s*\\)
in order to fold the end of arrays 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 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.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:

Applicable Issues
These issues refer to Python, but the same behavior exists when using IJulia.