Skip to content

Commit

Permalink
Merge pull request #2218 from Haehnchen/feature/doctrine-fix-string-l…
Browse files Browse the repository at this point in the history
…iteral

fix string literal casting on Doctrine querybuilder completion
  • Loading branch information
Haehnchen authored Aug 28, 2023
2 parents 2ff150f + edf3ee2 commit d43006a
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 d43006a

Please sign in to comment.