-
Notifications
You must be signed in to change notification settings - Fork 22
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
Fixes SExpression formatting #65
Conversation
…LUE` * Adds changes in `IonSExpressionBlock` to consider `SEXPRESSION_ATOM` as children as per BNF grammar * Adds changes in `IonCodeBlockSpacing` to correctly consider `SEXPRESSION_ATOM` as children as per BNF grammar
17b7b90
to
f0b4f52
Compare
* Removed operator definition and usage in SExp from grammar * All the code in gen/ is generated from IDE `generate parser` based on BNF grmmar * Removed all reference of sexpression operator * Modified test to format first element as a normal sexpression element
Thanks for tackling this! Regarding Removes treating first element as operator in SExp, there are some people who like to use lisp-style formatting for SExpressions in Ion. Could we keep it, but make it conditional based on some setting? Perhaps using something like this? |
I don't understand the goal of this PR. While not ideal, the current format-file behavior is better than the proposed change. S-expressions are intended to be used for code and should follow Lisp-like formatting by default. There's a lot one could say about the topic, but at minimum it should keep the first child element adjacent to the opening paren, and any line-breaks inside should have at least one level of indentation relative to the opening paren. |
This reverts commit c489a4e.
As per the review comments and the original implementation that used lisp style formatting, I am reverting the previous commit c489a4e. This PR still fixes some of the indentation and line break issue as described in As per the current implementation following is the After fix example:
|
* Changes SExpression children to use `SEXPRESSION_ATOM` instead of `VALUE` * Adds changes in `IonSExpressionBlock` to consider `SEXPRESSION_ATOM` as children as per BNF grammar * Adds changes in `IonCodeBlockSpacing` to correctly consider `SEXPRESSION_ATOM` as children as per BNF grammar * Adds changes in tests for usign correct node names * Adds changes for PR workflow to run Gradle Build task
Issue #64
Description of changes:
This PR fixes SExpression formatting
Example:
Sample Ion data(without any formatting):
Before the fix(After running code formatter from IDE):
After the fix(After running code formatter from IDE):
List of changes:
VALUE
IonSExpressionBlock
to considerSEXPRESSION_ATOM
as children as per BNF grammar
IonCodeBlockSpacing
to correctly considerSEXPRESSION_ATOM
as children as per BNF grammargenerate parser
based onBNF grmmar
Test:
Tested with gradle build task that runs all the tests. Also ran
buildPlugin
andrunIde
tasks.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.