Skip to content

Commit 11611fe

Browse files
committed
provide "form" fallback on unknown from type and support nested strings Haehnchen#325
1 parent becfe9e commit 11611fe

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/fr/adrienbrault/idea/symfony2plugin/form/FormOptionGotoCompletionRegistrar.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ public GotoCompletionProvider getProvider(@Nullable PsiElement psiElement) {
6565
@Nullable
6666
private GotoCompletionProvider getMatchingOption(ParameterList parameterList, @NotNull PsiElement psiElement) {
6767

68-
// form name can be a string alias
69-
String formTypeName = PsiElementUtils.getMethodParameterAt(parameterList, 1);
68+
// form name can be a string alias; also resolve on constants, properties, ...
69+
String formTypeName = PhpElementsUtil.getStringValue(PsiElementUtils.getMethodParameterPsiElementAt(parameterList, 1));
7070

7171
// formtype is not a string, so try to find php class types
7272
if(formTypeName == null) {
@@ -76,6 +76,11 @@ private GotoCompletionProvider getMatchingOption(ParameterList parameterList, @N
7676
}
7777
}
7878

79+
// fallback to form
80+
if(formTypeName == null) {
81+
formTypeName = "form";
82+
}
83+
7984
return new FormReferenceCompletionProvider(psiElement, formTypeName);
8085
}
8186

0 commit comments

Comments
 (0)