Skip to content

Tag @snippet not respected when formatting Javadoc #3802

@future2r

Description

@future2r

If I use the Java18 snippet tag, all Javadoc is still joined to a single line.
I copied the formatter settings from an Eclipse project, where everything works fine.

Environment
  • Operating System: Windows 11
  • JDK version: OpenJDK 21
  • Visual Studio Code version: 1.94.0
  • Java extension version: 1.35.1
Steps To Reproduce
  1. Create a Java file with this content
public class SnippetTest {

    /**
     * This is a snippet test.
     * {@snippet : 
     * System.out.println("Hello World");
     * }
     * @param args
     *            the arguments
     */
    public static void main(final String[] args) {
        System.out.println("Hello World");
    }
}
  1. Format the file with the attached settings.
Current Result
public class SnippetTest {

    /**
     * This is a snippet test. {@snippet : System.out.println("Hello World"); }
     * 
     * @param args
     *            the arguments
     */
    public static void main(final String[] args) {
        System.out.println("Hello World");
    }
}
Expected Result

see the first code block

Additional Informations

format.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions