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
Code Formatter #724
Merged
Merged
Code Formatter #724
Conversation
This file contains 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
Don't build a Block for SIGNIFICANT_WHITE_SPACE ASTNodes since Whitespace class will consume them.
`not` must be a separate token (NOT_OPERATOR) from the symbolic unary operators (UNARY_OPERATOR) as the symbolic operators in most styles have no space around them, but `not`, being a word, requires a space so that it doesn't merge with its argument to form an IDENTIFIER.
END_OF_EXPRESSION was being treated as an EOL if its first child was an EOL, but this was a bug because I forgot that it could include COMMENT interleaved with EOL because COMMENT never appears in Elixir.bnf, which was using to make Block.
Allow to configure whether there is a space after capture operator, but prevent & before another & from being combined and forming a &&.
Space around || and ||| is customizable, but space around `or` is fixed to 1 space to prevent fusion with surrounding identifiers.
Always 1 space around `and`. Space around `&&` and `&&&` is configurable.
Repository owner
deleted a comment
Jul 7, 2017
Repository owner
deleted a comment
Jul 7, 2017
Repository owner
deleted a comment
Jul 7, 2017
Repository owner
deleted a comment
Jul 7, 2017
Repository owner
deleted a comment
Jul 7, 2017
Repository owner
deleted a comment
Jul 7, 2017
Repository owner
deleted a comment
Jul 7, 2017
Repository owner
deleted a comment
Jul 7, 2017
Repository owner
deleted a comment
Jul 7, 2017
Repository owner
deleted a comment
Jul 7, 2017
Repository owner
deleted a comment
Jul 7, 2017
Repository owner
deleted a comment
Jul 7, 2017
Repository owner
deleted a comment
Jul 7, 2017
Repository owner
deleted a comment
Jul 7, 2017
Repository owner
deleted a comment
Jul 7, 2017
Repository owner
deleted a comment
Jul 7, 2017
Repository owner
deleted a comment
Jul 7, 2017
Repository owner
deleted a comment
Jul 7, 2017
Repository owner
deleted a comment
Jul 7, 2017
KronicDeth
added a commit
that referenced
this pull request
Jul 8, 2017
Closed
KronicDeth
added a commit
that referenced
this pull request
Jul 15, 2017
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.
Resolves #98
Changelog
Enhancements
do
block lines are indenteddo
blocksend
as the last argument of a no parentheses call unindents to the start of the callelse
.
and
in
or
when
=
<-
and\\
!=
,==
,=~
,!==
, and===
<
,<=
,>=
, and>
+
and-
*
and/
+
,-
,!
,^
, and~~~
->
::
|
||
and|||
&&
and&&&
<~
,|>
,~>
,<<<
,<<~
,<|>
,<~>
,>>>
, and~>>
..
^^^
++
,--
,..
,<>
=>
,
@
not
fn
after
catch
rescue
key:
&
,
{ }
<< >>
[ ]
( )
/
in&NAME/ARITY
and&QUALIFIER.NAME/ARITY
when
wraps when its right operand wraps, so that guards start withwhen
on a newline when they are too long.|>
at start of indented line for pipelinesend
with start of call instead of start of line fordo
blocks in pipelines::
when
when guards span multiple lines++
,--
,..
,<>
) operands, so that<>
binaries are multiple lines align their starts instead of using continuation indent and being indented relative to first operand.|
operands, so that alternates in types and specs are aligned instead of continuation indented relative to the first operand.spec
(that is above operands to|
align with the operands|>
is the start of a successive line.<< >>
) elements when wrapped