Skip to content

Commit

Permalink
Merge pull request #2288 from Haehnchen/feature/query-parameter
Browse files Browse the repository at this point in the history
fix casting and querybuilder parameter if not a string
  • Loading branch information
Haehnchen authored Feb 27, 2024
2 parents fb21902 + b54579d commit e1bb3b3
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e1bb3b3

Please sign in to comment.