Skip to content

Commit

Permalink
fix string literal casting on Doctrine querybuilder completion
Browse files Browse the repository at this point in the history
  • Loading branch information
Haehnchen committed Aug 28, 2023
1 parent 2ff150f commit edf3ee2
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,18 +147,17 @@ protected void addCompletions(@NotNull CompletionParameters completionParameters
return;
}

PsiElement context = psiElement.getParent();
if (context == null) {
PsiElement parent = psiElement.getParent();
if (!(parent instanceof StringLiteralExpression)) {
return;
}

MethodMatcher.MethodMatchParameter methodMatchParameter = MatcherUtil.matchField(context);
MethodMatcher.MethodMatchParameter methodMatchParameter = MatcherUtil.matchField(parent);
if (methodMatchParameter == null) {
return;
}

StringLiteralExpression parent = (StringLiteralExpression) psiElement.getParent();
String content = PsiElementUtils.getStringBeforeCursor(parent, completionParameters.getOffset());
String content = PsiElementUtils.getStringBeforeCursor((StringLiteralExpression) parent, completionParameters.getOffset());

QueryBuilderMethodReferenceParser qb = getQueryBuilderParser(methodMatchParameter.getMethodReference());
QueryBuilderScopeContext collect = qb.collect();
Expand Down

0 comments on commit edf3ee2

Please sign in to comment.