You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am implementing a code formatter for a language that has a number of constructs with code regions enclosed in keywords, in a nested fashion, for example a minimal program could be something like:
I would like to have a free line before the opening BEGIN_STRUCT keyword and if there already is one or more than one, I wish to keep those lines, but when I implement it according to the documentation (at least to my understanding of it) and apply the auto format multiple times, the formatting changes back and forth, adding and removing the desired line.
Langium version: current development (3.0 candidate)
Steps To Reproduce
For example just add this to the domain-model.langium grammar:
Then apply Format Document repeatedly to a document with the minimal program I wrote above.
The current behavior
The line before BEGIN_STRUCT alternatingly appears and is removed. More than one line is initially removed, after that same behaviour: alternate between empty line and no empty line before BEGIN_STRUCT.
The expected behavior
Depending on whether there already is a free line it should get added or simply left in the formatted code. Multiple applications of the format should not change anything after the first time. More than one free line should also be respected and not removed.
The text was updated successfully, but these errors were encountered:
I am implementing a code formatter for a language that has a number of constructs with code regions enclosed in keywords, in a nested fashion, for example a minimal program could be something like:
I would like to have a free line before the opening BEGIN_STRUCT keyword and if there already is one or more than one, I wish to keep those lines, but when I implement it according to the documentation (at least to my understanding of it) and apply the auto format multiple times, the formatting changes back and forth, adding and removing the desired line.
Langium version: current development (3.0 candidate)
Steps To Reproduce
For example just add this to the domain-model.langium grammar:
and register the two as AbstractElement:
then add this to the format function of the DomainModelFormatter:
Then apply
Format Document
repeatedly to a document with the minimal program I wrote above.The current behavior
The line before BEGIN_STRUCT alternatingly appears and is removed. More than one line is initially removed, after that same behaviour: alternate between empty line and no empty line before BEGIN_STRUCT.
The expected behavior
Depending on whether there already is a free line it should get added or simply left in the formatted code. Multiple applications of the format should not change anything after the first time. More than one free line should also be respected and not removed.
The text was updated successfully, but these errors were encountered: