diff --git a/src/main/java/fr/adrienbrault/idea/symfony2plugin/doctrine/querybuilder/QueryBuilderCompletionContributor.java b/src/main/java/fr/adrienbrault/idea/symfony2plugin/doctrine/querybuilder/QueryBuilderCompletionContributor.java index b6e314069..92b1f07d5 100644 --- a/src/main/java/fr/adrienbrault/idea/symfony2plugin/doctrine/querybuilder/QueryBuilderCompletionContributor.java +++ b/src/main/java/fr/adrienbrault/idea/symfony2plugin/doctrine/querybuilder/QueryBuilderCompletionContributor.java @@ -220,10 +220,14 @@ protected void addCompletions(@NotNull CompletionParameters completionParameters return; } + PsiElement parent1 = psiElement.getParent(); + if (!(parent1 instanceof StringLiteralExpression parent)) { + return; + } + QueryBuilderMethodReferenceParser qb = getQueryBuilderParser(methodMatchParameter.getMethodReference()); QueryBuilderScopeContext collect = qb.collect(); - StringLiteralExpression parent = (StringLiteralExpression) psiElement.getParent(); String content = PsiElementUtils.getStringBeforeCursor(parent, completionParameters.getOffset()); if (content == null || content.isBlank() || content.matches("^[\\w+.]+$")) { buildLookupElements(completionResultSet, collect);