Closed xpe closed 1 year ago
You have set "alignSemicolons" to hanging as well. This is probably why you got this result.
You have set "alignSemicolons" to hanging as well. This is probably why you got this result.
Do you agree with these statements:
alignSemicolons
should only apply to rule definitions.alignSemicolons
should not apply to the first line of a grammar file (e.g. grammar
, lexer grammar
, or parser grammar
).My goal is setup the extension to do ANTLR formatting along the lines of common examples provided in TDAR and many examples in the ANTLR4 grammars repo. This means:
:
, |
, and ;
lexer grammar FooGrammar;
)I don't think this is currently possible given the current setting options, which is why I filed this as a bug.
Do you agree with these statements:
* `alignSemicolons` should _only_ apply to rule definitions. * `alignSemicolons` should _not_ apply to the first line of a grammar file (e.g. `grammar`, `lexer grammar`, or `parser grammar`).
I haven't thought about other occurences than rules, so I cannot answer with yes currently. However, I have not seen output where the semicolon from the introducer line is placed on the next line and I have tests with all 3 semicolon settings. But maybe I just missed that.
My goal is setup the extension to do ANTLR formatting along the lines of common examples provided in TDAR and many examples in the ANTLR4 grammars repo. This means:
* in rules, align `:`, `|`, and `;` * use semicolons normally in non-rules (such as `lexer grammar FooGrammar;`)
I agree. The setting should not affect non-rules.
I don't think this is currently possible given the current setting options, which is why I filed this as a bug.
If that's the case then it should be fixed. Interesting here is that I never got a bug report for this issue, which either means people don't care about it or they never use hanging semicolons. I certainly do not.
The
alignColons
setting, as I understand it, should only impact colons (:
). However, I've noticed that it changes the formatting of semicolons (;
) on the first line in both my parser grammar and lexer grammar.For example, here is the result of formatting:
Just in case there might be some kind of interactions between settings, here are my settings: