Skip to content

Formatter removes first option in alternation rules #1571

Closed
@samir-abis

Description

@samir-abis

Langium version: 3.1.1 (extension)
Package name: langium

Steps To Reproduce

  1. Create a .langium file with an alternation rule like:
NumberTypeSpecialization:
    {infer Int} 'Int' |
    {infer Float} 'Float' |
    {infer Decimal} 'Decimal';
  1. Activate the format on Langium files

The current behavior

The formatter removes the first option in alternation rules, resulting in:

NumberTypeSpecialization:
    
     |
    {infer Float} 'Float' |
    {infer Decimal} 'Decimal';

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:

NumberTypeSpecialization:
    {infer Int} 'Int' |
    {infer Float} 'Float' |
    {infer Decimal} 'Decimal';

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions