File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
src/main/java/fr/adrienbrault/idea/symfony2plugin/completion Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 88import com .intellij .psi .PsiElement ;
99import com .intellij .psi .PsiFile ;
1010import com .intellij .psi .PsiWhiteSpace ;
11- import com .intellij .psi .util .PsiTreeUtil ;
1211import com .intellij .util .ThreeState ;
12+ import com .jetbrains .php .lang .parser .PhpElementTypes ;
1313import com .jetbrains .php .lang .psi .PhpFile ;
1414import com .jetbrains .php .lang .psi .PhpPsiUtil ;
1515import com .jetbrains .php .lang .psi .elements .*;
@@ -113,10 +113,21 @@ public static class PhpAttributeAutoPopupHandler extends TypedHandlerDelegate {
113113 public static @ Nullable PhpClass getPhpClass (@ NotNull PsiElement element ) {
114114 if (element .getParent () instanceof PhpClass phpClass ) {
115115 return phpClass ;
116- } else if (PhpPsiUtil .getNextSiblingIgnoreWhitespace (element , true ) instanceof PhpClass phpClass ) {
116+ }
117+
118+ // with use statement given
119+ PsiElement nextSiblingIgnoreWhitespace = PhpPsiUtil .getNextSiblingIgnoreWhitespace (element , true );
120+ if (nextSiblingIgnoreWhitespace instanceof PhpClass phpClass ) {
117121 return phpClass ;
118122 }
119123
124+ // no use statements
125+ if (nextSiblingIgnoreWhitespace != null && nextSiblingIgnoreWhitespace .getNode ().getElementType () == PhpElementTypes .NON_LAZY_GROUP_STATEMENT ) {
126+ if (nextSiblingIgnoreWhitespace .getFirstChild () instanceof PhpClass phpClass ) {
127+ return phpClass ;
128+ }
129+ }
130+
120131 return null ;
121132 }
122133
You can’t perform that action at this time.
0 commit comments