Fable icon indicating copy to clipboard operation
Fable copied to clipboard

Trim empty first line when using `emitStatement`, `emitJsStatement`, `emitExpr`, etc.

Open MangelMaxime opened this issue 1 year ago • 0 comments

Description

Trimming the first empty line would allow to write:

let repeatHello (count : int) : unit =
    emitStatement 
        count
        """
    cond = count;
    while cond > 0:
        print("Hello from Fable!")
        cond = cond - 1
    """

instead of

let repeatHello (count : int) : unit =
    emitStatement 
        count
        """cond = count;
    while cond > 0:
        print("Hello from Fable!")
        cond = cond - 1
    """

While keeping a really clean output without an extra empty line at the beginning or having the code not indected in the string expression.

  • Fable version: 4.1.4

MangelMaxime avatar Jun 28 '23 18:06 MangelMaxime