Skip to content

Commit

Permalink
Merge pull request #2371 from Haehnchen/feature/twig-component-name
Browse files Browse the repository at this point in the history
fix substring error if "twig:" is not fully given
  • Loading branch information
Haehnchen committed May 6, 2024
2 parents a365956 + 31c49c3 commit d8f8976
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,12 @@ protected void addCompletions(@NotNull CompletionParameters parameters, @NotNull
return;
}

for (PhpClass phpClass : UxUtil.getTwigComponentPhpClasses(position.getProject(), parentOfType.getName().substring(5))) {
String name = parentOfType.getName();
if (name.length() <= 5) {
return;
}

for (PhpClass phpClass : UxUtil.getTwigComponentPhpClasses(position.getProject(), name.substring(5))) {
UxUtil.visitComponentVariables(phpClass, pair -> {
PhpNamedElement field = pair.getSecond();

Expand Down

0 comments on commit d8f8976

Please sign in to comment.