Skip to content

fix: improve comment attachment on member chains - #1109

Merged
jtkiesel merged 1 commit into
jhipster:mainfrom
jtkiesel:fix/comments-on-ignored-member-chain
Oct 20, 2026
Merged

jtkiesel merged 1 commit into
jhipster:mainfrom
jtkiesel:fix/comments-on-ignored-member-chain

Conversation

@jtkiesel

@jtkiesel jtkiesel commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What changed with this PR:

Rather than attaching comments immediately before member chains as dangling comments, instead attaches them as leading comments, and separates comments immediately before the final member of a chain as dangling comments, to distinguish them. In Prettier, dangling comments are only meant to be attached to nodes that fully enclose them. All comments on ignored member chains are now printed. Previously, leading comments on member chains that were ignored might be omitted from being printed in certain situations.

Example

Input

var a = api.b(c ->
    // aaaaaaaaaaaaa
    c.d(d)
);

// @formatter:off
void main() {
    // @formatter:on
    List.of(
    // @formatter:off
            String
            .valueOf(
              "abc")
        );
}

Output

var a = api.b((c) ->
  // aaaaaaaaaaaaa
  c.d(d)
);

// @formatter:off
void main() {
  // @formatter:on
  List.of(
    // @formatter:off
    String
            .valueOf(
              "abc")
  );
}

Relative issues or prs:

Closes #955
Closes #1098
Closes #1115

@jtkiesel
jtkiesel force-pushed the fix/comments-on-ignored-member-chain branch from c0713ad to 5917bfa Compare October 20, 2026 03:59
@jtkiesel jtkiesel changed the title fix: print all comments on ignored member chains fix: improve comment attachment on member chains Oct 20, 2026
@jtkiesel
jtkiesel force-pushed the fix/comments-on-ignored-member-chain branch from 5917bfa to bc9efd5 Compare October 20, 2026 04:34
@jtkiesel
jtkiesel force-pushed the fix/comments-on-ignored-member-chain branch from bc9efd5 to 12e5aa3 Compare October 20, 2026 04:46
@jtkiesel
jtkiesel merged commit 83c68a6 into jhipster:main Oct 20, 2026
6 checks passed
@jtkiesel
jtkiesel deleted the fix/comments-on-ignored-member-chain branch October 20, 2026 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant