diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/PsiImplUtil.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/PsiImplUtil.java index 56ee73c4d2f0..35c4a4c33544 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/PsiImplUtil.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/PsiImplUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -964,7 +964,9 @@ public class PsiImplUtil { while (expr instanceof GrReferenceExpression) { final PsiElement nameElement = ((GrReferenceExpression)expr).getReferenceNameElement(); if (((GrReferenceExpression)expr).getTypeArguments().length > 0) return false; - if (nameElement == null || nameElement.getNode().getElementType() != GroovyTokenTypes.mIDENT) return false; + if (nameElement == null || !TokenSets.CODE_REFERENCE_ELEMENT_NAME_TOKENS.contains(nameElement.getNode().getElementType())) { + return false; + } IElementType dotType = ((GrReferenceExpression)expr).getDotTokenType(); if (dotType != null && dotType != GroovyTokenTypes.mDOT) return false; expr = ((GrReferenceExpression)expr).getQualifierExpression(); diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovyClassNameCompletionTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovyClassNameCompletionTest.groovy index 905523abeb35..fdeabb198ff2 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovyClassNameCompletionTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovyClassNameCompletionTest.groovy @@ -316,4 +316,33 @@ print new Upper.Inner() ''') } + void "test complete class within 'in' package"() { + myFixture.with { + addClass '''\ +package in.foo.com; +public class Foooo {} +''' + configureByText '_.groovy', 'Fooo' + complete CompletionType.BASIC + type '\n' + checkResult '''import in.foo.com.Foooo + +Foooo''' + } + } + + void "test complete class within 'def' package"() { + myFixture.with { + addClass '''\ +package def.foo.com; +public class Foooo {} +''' + configureByText '_.groovy', 'Fooo' + complete CompletionType.BASIC + type '\n' + checkResult '''import def.foo.com.Foooo + +Foooo''' + } + } }