Skip to content

Formatter merges pipelines (and everything, including documentation comments) in a single row #812

Closed

Description

@str-ay
Steps To Reproduce

1.1

return extractId(req).flatMap(cmsID -> service.find(cmsID))
            .flatMap(item -> ServerResponse.ok().syncBody(item))
            .doOnError(e -> log.debug(e.getMessage()))
            .onErrorResume(this::handleError);

1.2

+ "  spherical: true," 
+ "  query: {" 
+ "      status: 'publish',"
+ "      $or: [{endDate: {$gt: new Date()}}, {endDate: {$exists: false}}]" 
+ "  },"
  1. Alt Shift F / cmd k, f
Current Result

1.1

return extractId(req).flatMap(cmsID -> service.find(cmsID)).flatMap(item -> ServerResponse.ok().syncBody(item))
                .doOnError(e -> log.debug(e.getMessage())).onErrorResume(this::handleError);

1.2

+ "  spherical: true," + "  query: {" + "      status: 'publish',"
+ "      $or: [{endDate: {$gt: new Date()}}, {endDate: {$exists: false}}]" + "  },"
Expected Result

do not touch line breaks, please.
...or do not touch line breaks, when line starts with dot
(code, /** doc comments */ )

Activity

  1. vitorvr commented on Feb 27, 2019

    @vitorvr

    I have the same "issue".
    Camel routes like this:

    from(from)
      .routeId("routeID")
      .autoStartup(true)
      .convertBodyTo(String.class, "UTF-8")
      .to(destination);
    

    After format:
    from(from).routeId("routeID").autoStartup(true).convertBodyTo(String.class, "UTF-8").to(destination);

    I edited the Formatter in Eclipse and export it. Tried to use to a local path or GitHub URL but no such luck.

  2. fbricon commented on Feb 27, 2019

    @fbricon
    Collaborator

    You can add //@formatter:off at the beginning of the region you don't want to be formatted, and add //@formatter:on at the end, to turn it back on.

  3. str-ay commented on Feb 28, 2019

    @str-ay
    Author

    thanks for workaround. 2 extra lines, but should be helpful for me, will try

  4. samba2 commented on Jun 17, 2019

    @samba2

    I have the same issue, the suggested workaround might help but in times of functional Java and Internal DSLs the VS Code auto formatter is actually hardly useful.

    Please provide a solution for this. 🙏

  5. rasitayaz commented on Aug 12, 2021

    @rasitayaz

    Still having this issue, no fixes yet?

  6. snjeza commented on Aug 12, 2021

    @snjeza
    Collaborator
  7. dada-hua commented on Jul 1, 2023

    @dada-hua

    I think you can:

    <setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="false"/>

    Set false, it may be ok!

  8. robstryker commented on Nov 2, 2026

    @robstryker
    Contributor

    I'm going to close this issue as likely fixed with two workarounds (See snjeza's comment and dada-hua). If it's still replicatable please re-open it.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions