Skip to content
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

Added support for @TemplateGlobal annotation #636

Merged

Conversation

AlexXuChen
Copy link
Contributor

@AlexXuChen AlexXuChen commented May 12, 2022

Added support for @TemplateGlobal annotation.
templateglobaldemo2

Fixes #605

Signed-off-by: Alexander Chen alchen@redhat.com

@AlexXuChen AlexXuChen changed the title Added @TemplateGlobal annotation support Added support for @TemplateGlobal annotation support May 12, 2022
@AlexXuChen AlexXuChen changed the title Added support for @TemplateGlobal annotation support Added support for @TemplateGlobal annotation May 12, 2022
@AlexXuChen AlexXuChen force-pushed the issue605-tempalte-global branch 2 times, most recently from 9204248 to 9259402 Compare May 26, 2022 14:48
@AlexXuChen AlexXuChen marked this pull request as ready for review May 26, 2022 15:12
@AlexXuChen
Copy link
Contributor Author

Template global example:

package org.acme;

import io.quarkus.qute.TemplateGlobal;

enum Color { RED, GREEN, BLUE }

@TemplateGlobal
public class Globals {

    static int age = 40;

    static String name;

    static Color[] myColors() {
      return new Color[] { Color.RED, Color.BLUE };
    }

    @TemplateGlobal(name = "currentUser")
    static String user() {
       return "Mia";
    }
}

@AlexXuChen AlexXuChen force-pushed the issue605-tempalte-global branch 5 times, most recently from 499075a to 4a05eca Compare May 26, 2022 19:31
@AlexXuChen
Copy link
Contributor Author

name attribute is also supported:
templateglobaldemoname

Copy link
Member

@rgrunber rgrunber left a comment

Choose a reason for hiding this comment

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

Works pretty well for me, but noticed a few things worth fixing.

@AlexXuChen AlexXuChen force-pushed the issue605-tempalte-global branch 2 times, most recently from 2de62e5 to 2d910f9 Compare May 27, 2022 22:40
@angelozerr
Copy link
Contributor

There is compilation problem https://github.com/redhat-developer/quarkus-ls/runs/6632720210?check_suite_focus=true#step:8:142 you miss to define this method since you add globalVariable parameter (you define a new assertResolver by calling false for globalVariable).

Signed-off-by: Alexander Chen <alchen@redhat.com>
@angelozerr
Copy link
Contributor

Great job @AlexXuChen !

@rgrunber rgrunber added this to the v0.12.0 milestone May 31, 2022
@AlexXuChen AlexXuChen deleted the issue605-tempalte-global branch May 31, 2022 15:19
@rgrunber rgrunber removed this from the v0.12.0 milestone May 31, 2022
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.

Support for @TemplateGlobal
3 participants