Skip to content

Conversation

@angelozerr
Copy link
Contributor

Qute debugging support inside Java file

@datho7561
Copy link
Contributor

I tried this:

image

And this breakpoint doesn't hit, even though I can tell that the expression is being rendered since the website shows the name parameter that I passed in.

@angelozerr
Copy link
Contributor Author

Is it working wirh simple string?

@datho7561
Copy link
Contributor

Is it working wirh simple string?

Do you mean as the parameter to the annotation, or something like value instead of {name} inside the template itself? I'll try both.

@angelozerr
Copy link
Contributor Author

I mean this sample redhat-developer/vscode-quarkus#1196

@datho7561
Copy link
Contributor

I double checked and debugging this template:

@TemplateContents("{@java.lang.String name}\n" +
			"hello\n" +
			"{#if name == null or name.isEmpty}\n" +
			"world\n" +
			"{#else}\n" +
			"{name}\n" +
			"{/if}")

works properly like that but not if multiline strings are used:

@TemplateContents("""
		{@java.lang.String name}
		hello
		{#if name == null or name.isEmpty}
		world
		{#else}
		{name}
		{/if}""")

@angelozerr angelozerr self-assigned this Jan 12, 2026
@angelozerr angelozerr requested a review from datho7561 January 12, 2026 15:15
@angelozerr angelozerr added this to the 0.23.1 milestone Jan 12, 2026
@angelozerr angelozerr moved this to In Progress in Java Tooling Jan 12, 2026
@angelozerr angelozerr force-pushed the qute_debug_in_java_annotation2 branch 2 times, most recently from 531116e to 3f00531 Compare January 12, 2026 19:09
@angelozerr
Copy link
Contributor Author

works properly like that but not if multiline strings are used

Please retry it should be fixed now. I am using ASTVisitor to get the line start.

@datho7561 please note that it should work if you change the content of TemplateContents or add new lines before TemplateContents after doing a Java file save. When you save Java file, Quarkus app is restarted and debugger is reset to remove the start line cache.

@angelozerr angelozerr force-pushed the qute_debug_in_java_annotation2 branch 2 times, most recently from 34f4a8d to 86ef3d4 Compare January 13, 2026 08:48
@angelozerr angelozerr marked this pull request as ready for review January 13, 2026 08:49
@angelozerr angelozerr force-pushed the qute_debug_in_java_annotation2 branch 4 times, most recently from 641e3b1 to 6a01ff6 Compare January 14, 2026 18:04
@angelozerr
Copy link
Contributor Author

@datho7561 could your synchronize the 3 PRs and retest it again.

I have managed TemplateContents in Java method which works with CheckedTemplate.

Here the usecase:

package org.acme.sample;

import io.quarkus.qute.CheckedTemplate;
import io.quarkus.qute.TemplateContents;
import io.quarkus.qute.TemplateInstance;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam;

public class TemplateContentsResource {
    
    @TemplateContents(value = "Hello {name}!")
    record Hello(String name) implements TemplateInstance {}

    @TemplateContents("""
            Hello {name}!
            """;)
    record Hello2(String name) implements TemplateInstance {}

    @CheckedTemplate
    public static class Templates {
        @TemplateContents("Item is {item}")
        public static native TemplateInstance item(String item);  
    }

    @GET
    public TemplateInstance hello(@QueryParam("name") String name) {
        return new Hello(name); 
    }

    @GET
    public TemplateInstance hello2(@QueryParam("name") String name) {
        return new Hello2(name); 
    }
    
    @GET
    @Path("/item")
    public TemplateInstance item() {
        return Templates.item("foo"); 
    }
}

@angelozerr angelozerr force-pushed the qute_debug_in_java_annotation2 branch 3 times, most recently from 0ceaf79 to 16390c3 Compare January 14, 2026 19:49
@angelozerr angelozerr force-pushed the qute_debug_in_java_annotation2 branch from 16390c3 to 65e7ebb Compare January 14, 2026 19:53
Copy link
Contributor

@datho7561 datho7561 left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks, Angelo!

@datho7561 datho7561 merged commit da1744e into redhat-developer:master Jan 14, 2026
4 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Java Tooling Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants