Skip to content
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

Indent after comment line #308

Closed
benjavalero opened this issue Dec 3, 2019 · 7 comments
Closed

Indent after comment line #308

benjavalero opened this issue Dec 3, 2019 · 7 comments

Comments

@benjavalero
Copy link

After a comment line, if the block below is formatted, it gets unnecessarily indented.

Input:

// 1 result in DB by no type
Mockito.when(replacementRepository.findRandomArticleIdsToReview(Mockito.any(PageRequest.class)))
        .thenReturn(new ArrayList<>(Collections.singletonList(randomId2)));

Output (0.4.0):

// 1 result in DB by no type
    Mockito.when(
        replacementRepository.findRandomArticleIdsToReview(Mockito.any(PageRequest.class))
    ).thenReturn(new ArrayList<>(Collections.singletonList(randomId2)));

Expected output:

// 1 result in DB by no type
Mockito.when(
    replacementRepository.findRandomArticleIdsToReview(Mockito.any(PageRequest.class))
).thenReturn(new ArrayList<>(Collections.singletonList(randomId2)));
@jhaber
Copy link
Contributor

jhaber commented Dec 3, 2019

Might be worth re-testing on master since 0.4.0 doesn't include #278

@murdos
Copy link

murdos commented Dec 3, 2019

@clement26695: BTW it would nice to do a new release, since a lot of interesting things has landed in master 😉

@benjavalero
Copy link
Author

Might be worth re-testing on master since 0.4.0 doesn't include #278

I think I have retested against master and still get the same behaviour.

@clementdessoude
Copy link
Contributor

I'll try to have a look when I have some time, probably next weekend.

@murdos it was the plan to do one last weekend, but I got some computer issues unfortunately. I'll try to do one this weekend too !

@clementdessoude
Copy link
Contributor

Just tested with master branch. When I try to format this :

class T {
	void t() {
		// 1 result in DB by no type
Mockito.when(replacementRepository.findRandomArticleIdsToReview(Mockito.any(PageRequest.class)))
.thenReturn(new ArrayList<>(Collections.singletonList(randomId2)));
	}
}

I got this:

class T {

  void t() {
    // 1 result in DB by no type
    Mockito
      .when(
        replacementRepository.findRandomArticleIdsToReview(
          Mockito.any(PageRequest.class)
        )
      )
      .thenReturn(new ArrayList<>(Collections.singletonList(randomId2)));
  }
}

with these options:

--print-width 80
--tab-width 2

@benjavalero
Copy link
Author

Sorry, I wasn't using the master version of java-parser.

@clementdessoude
Copy link
Contributor

Don't be sorry, it is really helpful to have your feedbacks! And we should improve our docs :)

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

4 participants