Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Non-stacking indentation is discarded on comments #135

Open
lucaswerkmeister opened this issue Feb 24, 2017 · 1 comment
Open

Non-stacking indentation is discarded on comments #135

lucaswerkmeister opened this issue Feb 24, 2017 · 1 comment
Milestone

Comments

@lucaswerkmeister
Copy link
Contributor

The formatter thinks this is the correct way to indent this code:

void f() {
    Boolean b = true ||
            true ||
            // comment
    true ||
            /*
             * comment
             */
    true ||
            true;
}

The indentation after a binary operator (two levels) never stacks, but I do think that dropping it after a comment is too eager. Making the comment token inherit the ephemeral indentation (also with never, so for inline comments it makes no difference) should solve this.

@lucaswerkmeister lucaswerkmeister added this to the Postponed milestone Feb 24, 2017
lucaswerkmeister added a commit that referenced this issue Feb 18, 2018
When creating a new token for a comment, use the current ephemeral
indentation for the comment’s indentAfter, so that after the comment is
processed, the ephemeral indentation is restored to that value.

Part of #135.
lucaswerkmeister added a commit that referenced this issue Feb 18, 2018
Note that the case of multi-line comments isn’t included, since it
doesn’t work yet.
@lucaswerkmeister
Copy link
Contributor Author

Works now for comments that don’t span multiple lines. Unfortunately, I don’t think I’ll be able to figure out the multi-line case until I get a working IDE setup again :/ but it’s better than nothing, at least.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant