Skip to content

Conversation

@JoelWilcox
Copy link
Member

Fixes #631

@JoelWilcox JoelWilcox marked this pull request as ready for review August 3, 2022 22:20
Copy link
Contributor

@RBusarow RBusarow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

if (templateEntry is KtSimpleNameStringTemplateEntry ||
templateEntry is KtBlockStringTemplateEntry
) {
parsePsiElement(templateEntry.expression as PsiElement)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like the bug is that we're calling getChildOfType instead of getChildrenOfType which is why the rest of the string doesn't come along. Why are you parsing both of the elements instead of just doing a joinToString(", ") on both parts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case there were two separate issues. You're correct about the first one which was that we were only grabbing text for the first part of the template regardless of template length. The second issue was that we were just treating the template as plain text, which results in constants staying as their code text instead of their value (e.g. returning ${CONSTANT} instead of resolving it).

@JoelWilcox JoelWilcox merged commit 70f9a77 into main Aug 4, 2022
@JoelWilcox JoelWilcox deleted the joel.string-templates branch August 4, 2022 18:26
@vRallev
Copy link
Collaborator

vRallev commented Aug 13, 2022

Beautiful PR. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AnnotationArgumentReference.Psi does not parse string templates correctly

5 participants