Skip to content

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

@Chealer

Description

@Chealer

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions