add javadoc intention: fix for multiple field declaration IDEA-177456

This commit is contained in:
Dmitry Batkovich
2017-08-11 15:54:58 +03:00
parent 66a38c8054
commit c3bc554410
9 changed files with 64 additions and 1 deletions

View File

@@ -409,7 +409,12 @@ public class JavaDocumentationProvider extends DocumentationProviderEx implement
}
return false;
});
return docCommentOwner == null ? null : Pair.create(docCommentOwner, ((PsiDocCommentOwner)docCommentOwner).getDocComment());
if (docCommentOwner == null) return null;
PsiDocComment comment = ((PsiDocCommentOwner)docCommentOwner).getDocComment();
if (docCommentOwner instanceof PsiField) {
docCommentOwner = ((PsiField)docCommentOwner).getModifierList();
}
return Pair.create(docCommentOwner, comment);
}
@Override

View File

@@ -0,0 +1,11 @@
// "Add Javadoc" "true"
class Test {
/**
*
*/
@XXX
int xxx = 1;
}

View File

@@ -0,0 +1,10 @@
// "Add Javadoc" "true"
class Test {
/**
*
*/
private @XXX int xxx = 1;
}

View File

@@ -0,0 +1,7 @@
// "Add Javadoc" "true"
class Foo {
/**
*
*/
int x = 2, y = 1;
}

View File

@@ -0,0 +1,7 @@
// "Add Javadoc" "true"
class Foo {
/**
*
*/
int x = 2, y = 1;
}

View File

@@ -0,0 +1,8 @@
// "Add Javadoc" "true"
class Test {
@XXX
int x<caret>xx = 1;
}

View File

@@ -0,0 +1,7 @@
// "Add Javadoc" "true"
class Test {
private @XXX int x<caret>xx = 1;
}

View File

@@ -0,0 +1,4 @@
// "Add Javadoc" "true"
class Foo {
int x = 2, <caret>y = 1;
}

View File

@@ -0,0 +1,4 @@
// "Add Javadoc" "true"
class Foo {
int <caret>x = 2, y = 1;
}