Skip to content

Java nested lambdas formatting is incredibly poor #990

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kberezin-nshl opened this issue Nov 15, 2023 · 3 comments
Closed

Java nested lambdas formatting is incredibly poor #990

kberezin-nshl opened this issue Nov 15, 2023 · 3 comments

Comments

@kberezin-nshl
Copy link

I already posted a comment: #137 (comment)
but it was ignored.

Duplicating here.

Elasticsearch API. What I would like to have:

      var hits =
          elasticsearchClient
              .search(r -> r.index(indexName)
                  .query(q -> q.bool(
                      b -> b
                          .must(job -> job.match(t -> t.field("job_id").query(jobId)))
                          .must(str -> str.queryString(
                              qs -> qs.query("\"%s\"".formatted(searchString))))))
                  .size(request.getPageSize()),
                  Doc.class);

what I get:

      var hits =
          elasticsearchClient
              .search(
                  r ->
                      r.index(indexName)
                          .query(
                              q ->
                                  q.bool(
                                      b ->
                                          b.must(
                                                  job ->
                                                      job.match(
                                                          t -> t.field("job_id").query(jobId)))
                                              .must(
                                                  str ->
                                                      str.queryString(
                                                          qs ->
                                                              qs.query(
                                                                  "\"%s\""
                                                                      .formatted(searchString))))))
                          .size(request.getPageSize()),
                  Doc.class);
@cushon
Copy link
Collaborator

cushon commented Dec 7, 2023

This is a duplicate of #137

@cushon cushon closed this as completed Dec 7, 2023
@kberezin-nshl
Copy link
Author

How is this a duplicate, @cushon?

This is an issue with the formatter. It expands a 7-8 line long code into 15-20 long code.
I am not asking to switch the formatter off here, I am asking to reconsider the formatter's Java lambda support.

@cushon
Copy link
Collaborator

cushon commented Dec 11, 2023

That was the wrong bug number, I meant #19.

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

No branches or pull requests

2 participants