cincheo / jsweet

A Java to JavaScript transpiler.
http://www.jsweet.org
Other
1.45k stars 160 forks source link

Indentation in comments is lost in transpilation #617

Open apaatsio opened 3 years ago

apaatsio commented 3 years ago

Indentation in comments is lost in transpilation. JavaDocs often contain indented HTML or they can have code samples where the indentation is preferable to preserve.

To reproduce:

Transpile the following Java class to TypeScript:

/**
 * <ul>
 *   <li>Hello
 *   <li>World
 * </ul>
 */
public class Foo {}

Actual result:

/* Generated from Java with JSweet 2.2.0-SNAPSHOT - http://www.jsweet.org */
/**
 * <ul>
 * <li>Hello
 * <li>World
 * </ul>
 * @class
 */
class Foo {}
Foo["__class"] = "Foo";

Expected result:

/* Generated from Java with JSweet 2.2.0-SNAPSHOT - http://www.jsweet.org */
/**
 * <ul>
 *   <li>Hello
 *   <li>World
 * </ul>
 * @class
 */
class Foo {}
Foo["__class"] = "Foo";

JSweet version used: http://www.jsweet.org/jsweet-live-sandbox/

lgrignon commented 3 years ago

Thanks for reporting.

Do you want to take a look and submit PR?