Skip to content

Commit ca79530

Browse files
committed
twig root variable pattern should not fire after DOT value
1 parent ad51bff commit ca79530

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/fr/adrienbrault/idea/symfony2plugin/TwigHelper.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,21 @@ public static ElementPattern<PsiElement> getPrintBlockFunctionPattern() {
265265
return PlatformPatterns.psiElement().withParent(PlatformPatterns.psiElement(TwigElementTypes.PRINT_BLOCK)).withLanguage(TwigLanguage.INSTANCE);
266266
}
267267

268+
/**
269+
* {{ form(foo) }}, {{ foo }}
270+
* NOT: {{ foo.bar }}
271+
*/
268272
public static ElementPattern<PsiElement> getCompletablePattern() {
269273
return PlatformPatterns.psiElement()
270-
.afterLeaf(
274+
.andNot(
275+
PlatformPatterns.psiElement().afterLeaf(PlatformPatterns.psiElement(TwigTokenTypes.DOT))
276+
)
277+
.afterLeafSkipping(
271278
PlatformPatterns.or(
272279
PlatformPatterns.psiElement(TwigTokenTypes.LBRACE),
273280
PlatformPatterns.psiElement(PsiWhiteSpace.class)
274-
)
281+
),
282+
PlatformPatterns.psiElement()
275283
)
276284
.withParent(PlatformPatterns.psiElement(TwigElementTypes.PRINT_BLOCK))
277285
.withLanguage(TwigLanguage.INSTANCE);

0 commit comments

Comments
 (0)