-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Smart inference of Java type for user tag parameter #913
Comments
Actually, I think the theory is that I should define a Java class to declare the tags parameters, I'm sure I discussed it with @mkouba but I can't find where. Something like: public class tags {
@CheckedTemplates
public static class Templates {
public static native TemplateInstance myUser(User user);
}
} Or was it? @CheckedTemplates
public class tags {
public static native TemplateInstance myUser(User user);
} I can't recall. It's been discussed in quarkusio/quarkus#21859 though, as well as default parameter values (added in quarkusio/quarkus#25488). I don't know if we can declare default template parameter values from the Java side, though. Perhaps only when declaring parameters in the template? |
Otherwise, we can declare {@model.User user}
Login: {user.login} |
Indeed it is working. I think it is the best solution, no? |
You can both a type-safe template that corresponds to Both @CheckedTemplates
public class tags {
static native TemplateInstance myUser(User user);
} and @CheckedTemplate(basePath = "tags"
public class Whatever {
static native TemplateInstance myUser(User user);
} should work. Both solutions are equally good. |
So I wasn't wrong, yay :) I didn't find this documented in https://quarkus.io/guides/qute-reference#typesafe_templates though, probably it should, no? |
Well, tags are regular templates located in a special folder ( |
Given this user tag
src/main/resources/tags/myUser.html
:At this step, we cannot know what is user
Given a Qute template which consumes the user tag
At this step we can inject the
org.acme.User
Java type inside themyUser.html
which will provide completion, validation, hover, defintion,etcThis feature is very important to support for instance https://github.com/FroMage/RivieraDEV-Quarkus/blob/main/src/main/resources/templates/tags/organisers.html
The text was updated successfully, but these errors were encountered: