fsprojects / fantomas-for-vs

Visual Studio Formatter for F#
https://marketplace.visualstudio.com/items?itemName=asti.fantomas-vs
46 stars 10 forks source link

Formatting differs in VS from online fantomas even though I didn't touch the defaults #8

Closed chtenb closed 3 years ago

chtenb commented 3 years ago

Hi

When trying to format the following code in the online formatter

let pIgnore p = p >>= fun _ -> fun rest -> Success ((), rest)
let pOption p = (p >>= fun result -> pReturn <| Some result) <|> pReturn None
let lookAhead (p:Parser<'a>) (input:Input) =
    (p >>= fun _ -> fun _ -> Success ((), input)) input

the result looks like

let pIgnore p =
    p >>= fun _ -> fun rest -> Success((), rest)

let pOption p =
    (p >>= fun result -> pReturn <| Some result)
    <|> pReturn None

let lookAhead (p: Parser<'a>) (input: Input) =
    (p >>= fun _ -> fun _ -> Success((), input)) input

However when I try it in VS using this plugin I get

let pIgnore p =
    p
    >>= fun _ -> fun rest -> Success((), rest)

let pOption p =
    (p
     >>= fun result -> pReturn <| Some result)
    <|> pReturn None

let lookAhead (p: Parser<'a>) (input: Input) =
    (p
     >>= fun _ -> fun _ -> Success((), input)) input

which looks really odd. I didn't change the defaults, and even after explicitly adding the editorconfig with default values the behaviour stayed the same. Any idea what might be going wrong?

deviousasti commented 3 years ago

The nicer formatting is generated only by the latest release of Fantomas which breaks formatting options and needs some work to patch through.

I've done most of the work - I'll try to ship today.

deviousasti commented 3 years ago

I've released an update. Could you try it out?

chtenb commented 3 years ago

Great, it seems to work nicely now! Thanks