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

Tooltips (Hover): Missing newlines for JavaDoc {@literal} tags #3758

Open
Chealer opened this issue Aug 30, 2024 · 0 comments
Open

Tooltips (Hover): Missing newlines for JavaDoc {@literal} tags #3758

Chealer opened this issue Aug 30, 2024 · 0 comments

Comments

@Chealer
Copy link

Chealer commented Aug 30, 2024

When an element (annotations and presumably functions and properties) with Javadoc is previewed by hovering, the rendered tooltip lacks newlines if the Javadoc contains {@literal} tags. This is probably specific to those at the beginning of lines, as can be seen in io.quarkus.arc.lookup.LookupIfProperty:

/**
 * Indicates that a bean should only be obtained by programmatic lookup if the property matches the provided value.
 * <p>
 * This annotation is repeatable. A bean will be included if all the conditions defined by the {@link LookupIfProperty} and
 * {@link LookupUnlessProperty} annotations are satisfied.
 *
 * <pre>
 * <code>
 *  interface Service {
 *     String name();
 *  }
 *
 *  {@literal @LookupIfProperty(name = "service.foo.enabled", stringValue = "true")}
 *  {@literal @ApplicationScoped}
 *  class ServiceFoo implements Service {
 *
 *     public String name() {
 *        return "foo";
 *     }
 *  }
 *
 *  {@literal @ApplicationScoped}
 *  class ServiceBar {
 *
 *     public String name() {
 *        return "bar";
 *     }
 *  }
 *
 *  {@literal @ApplicationScoped}
 *  class Client {
 *
 *     {@literal @Inject}
 *     Instance&lt;Service&gt; service;
 *
 *     void printServiceName() {
 *        // This would print "bar" if the property of name "service.foo.enabled" was set to false
 *        // Note that service.get() would normally result in AmbiguousResolutionException
 *        System.out.println(service.get().name());
 *     }
 *  }
 *  </code>
 * </pre>
 *
 * @see Instance
 */
@Repeatable(LookupIfProperty.List.class)
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD })
public @interface LookupIfProperty {

    /**
     * Name of the runtime property to check
     */
    String name();

    /**
     * Expected {@code String} value of the runtime property (specified by {@code name}) if the bean should be looked up at
     * runtime.
     */
    String stringValue();

    /**
     * Determines if the bean is to be looked up when the property name specified by {@code name} has not been specified at all
     */
    boolean lookupIfMissing() default false;

    @Retention(RetentionPolicy.RUNTIME)
    @Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD })
    @interface List {

        LookupIfProperty[] value();

    }
}

As the website shows, the Javadoc itself is fine, but VS Code doesn't parse it properly.

Environment
  • Operating System: Windows 10
  • JDK version: 17
  • Visual Studio Code version: 1.92.2
  • Java extension version: 1.34.0
Steps To Reproduce
  1. Open a Java file which refers to a JavaDoc-annotated method or annotation
  2. Move the cursor over the element's name
Current Result

A newline per @literal tag is missing:
VS Code hover literal

Expected Result

A line in <pre><code> should be rendered on its own line, even if it only contains a @literal tag.

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

No branches or pull requests

1 participant