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 found where is the issue in the formatter code:
Sometime the between range has a start position after the end position that lead to incorrect edits :
Returning an empty edit in such case fix the issue.
// Ignore the edit if the previous node ends after the current node startsif(a&&(a.range.end.line>b.range.start.line||(a.range.end.line===b.range.start.line&&a.range.end.character>b.range.start.character))){return[];}constbetweenRange: Range={start: a?.range.end??{character: 0,line: 0},end: b.range.start};
@msujew I can provide a PR if you are interested. It can be included in #1628 or in a separate PR if you prefer.
Langium version: 3.1.1 (extension)
Package name: langium
Steps To Reproduce
The current behavior
The formatter removes the first option in alternation rules, resulting in:
This occurs for any rule that starts with an alternation (|).
The expected behavior
The formatter should preserve all options in alternation rules, maintaining the original structure:
The text was updated successfully, but these errors were encountered: