Skip to content

Formatter: Retain information on Bracket Expressions #156

Description

@kindlich

Currently, Bracket Expression Parsers can return any ParsedExpression and the information about the bracket expression is lost during the parsing.

Therefore, when using the code-formatter, the Bracket Expressions are replaced by their Parsed-Expression equivalent, which is not optimal for formatting scripts.

Example:

println(<item:minecraft:bedrock>.commandString);

// becomes after a re-format
println(BracketHandlers.getItem("minecraft:bedrock").commandString);

Possible Fixes/Ideas:

  • Optionally attach a custom Tag to Parsed expressions which will be used in the code-formatter if present.
    return expression.hasTag(FormattingInfo.class) ? expression.getTag(FormattingInfo.class).format() : expression.accept(formatterVisitor);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestformatterIssues that concern the code-formatterparser

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions