-
Notifications
You must be signed in to change notification settings - Fork 97
Modify foldEndPattern in Atom settings #161
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
1st1
commented
Sep 12, 2018
LGTM. @vpetrovykh please take a look
Contributor
vpetrovykh
commented
Sep 12, 2018
Looks good. Thanks for the detailed explanation and examples!
Contributor
Author
kylebarron
commented
Sep 12, 2018
Thanks! It appears that there hasn't been a release since August 2017. Do you have any idea for a timeline of when the next release might happen?
Member
1st1
commented
Sep 12, 2018
I'll cut the next release sometime next week. Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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-pythonatom/language-python#274, though the text is modified slightly for MagicPython)Description of the Change
Add a value for
foldEndPatternin 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-javascriptbecause 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
foldEndPatternin MagicPython is^\\s*"""\\s*$. Thelanguage-pythonfoldEndPatternused 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:
image
Current fold behavior:
image
New fold behavior:
image
Current Hydrogen behavior with ending character on separate line:
image
New Hydrogen behavior with ending character on separate line:
image
Possible Drawbacks
Those who prefer the current behavior could be disappointed? I can't think of any others.
Applicable Issues