Formatting document removes '#if DEBUG' and '#endif' #512
Closed
Description
Description
(Punted from Ionide issue ionide/ionide-vscode-fsharp#1246)
Encountered when saving a file in a Fable/Elmish project which has this construct, where parts of a piped expression are switched in when in DEBUG:
Program.mkProgram init update view
|> Program.toNavigable parser setRoute
|> Program.withConsoleTrace
#if DEBUG
|> Program.withHMR
#endif
|> Program.withReact "elmish-app"
#if DEBUG
|> Program.withDebugger
#endif
|> Program.run
When formatting, this gets changed to:
Program.mkProgram init update view
|> Program.toNavigable parser setRoute
|> Program.withConsoleTrace
|> Program.withHMR
|> Program.withReact "elmish-app"
|> Program.withDebugger
|> Program.run
To Reproduce
Steps to reproduce the behaviour:
- Create a fs file with this code:
let foo = [ 1 ]
|> List.sort
#if DEBUG
|> List.rev
#endif
|> List.sort
- Execute Format Code, or save the file if format on save is enabled
Expected behaviour
Directives are left untouched
Environment (please complete the following information):
- OS: Win 10 1903
- Ionide version: 4.2.0
- VSCode version: 1.39.1
- dotnet SDK version: 2.2
- mono / .Net Framework version:
Repro code
Metadata
Assignees
Labels
No labels