restore autopopup after typing # in javadoc (IDEA-135231)

This commit is contained in:
peter
2015-01-14 17:58:35 +01:00
parent bdacb837a0
commit 3ad0612c6a
2 changed files with 21 additions and 5 deletions
@@ -33,11 +33,16 @@ public class JavadocCompletionConfidence extends CompletionConfidence {
@NotNull
@Override
public ThreeState shouldSkipAutopopup(@NotNull PsiElement contextElement, @NotNull PsiFile psiFile, int offset) {
if (psiElement().inside(PsiDocTag.class).accepts(contextElement) && findJavaReference(psiFile, offset - 1) != null) {
return ThreeState.NO;
}
if (PlatformPatterns.psiElement(JavaDocTokenType.DOC_TAG_NAME).accepts(contextElement)) {
return ThreeState.NO;
if (psiElement().inside(PsiDocTag.class).accepts(contextElement)) {
if (findJavaReference(psiFile, offset - 1) != null) {
return ThreeState.NO;
}
if (PlatformPatterns.psiElement(JavaDocTokenType.DOC_TAG_NAME).accepts(contextElement)) {
return ThreeState.NO;
}
if (contextElement.textMatches("#")) {
return ThreeState.NO;
}
}
return super.shouldSkipAutopopup(contextElement, psiFile, offset);
}
@@ -256,6 +256,17 @@ class JavaAutoPopupTest extends CompletionAutoPopupTestCase {
assert lookup
}
public void "test popup after hash in javadoc"() {
myFixture.configureByText("a.java", """
/**
* {@link String<caret>}
*/
class Foo {}
""")
type '#'
assert lookup
}
public void "test popup in javadoc local reference"() {
myFixture.configureByText("a.java", """
/**