SortContentAction: fix javadoc movement while sorting enum constants

This commit is contained in:
Roman.Ivanov
2018-08-30 11:31:17 +07:00
parent 4020d3b5f8
commit 40ba62d4d8
3 changed files with 36 additions and 1 deletions
@@ -881,7 +881,9 @@ public class SortContentAction extends PsiElementBaseIntentionAction {
//PsiEnumConstant holds comments inside, we need codegen to know about this comments to place \n correctly
for (SortableEntry entry : sortableList.myEntries) {
List<PsiComment> comments = StreamEx.ofTree(entry.myElement, el -> StreamEx.of(el.getChildren())).select(PsiComment.class).toList();
List<PsiComment> comments = StreamEx.ofTree(entry.myElement, el -> StreamEx.of(el.getChildren()))
.select(PsiComment.class)
.filter(comment -> !(comment instanceof PsiDocComment)).toList();
for (PsiComment comment : comments) {
entry.myBeforeSeparator.add((PsiComment)comment.copy());
comment.delete();
@@ -0,0 +1,17 @@
// "Sort content" "true"
public enum OSType {
/**
* one
*/
ONE,
/**
* three
*/
THREE,
/**
* two
*/
TWO
}
@@ -0,0 +1,16 @@
// "Sort content" "true"
public enum OSType {
/**
* one
*/
ONE,<caret>
/**
* two
*/
TWO,
/**
* three
*/
THREE
}