Skip to content

Commit

Permalink
Fix for fsprojects#321 to only wrap formatContext.Source with an opti…
Browse files Browse the repository at this point in the history
…on when there is a string present
  • Loading branch information
Dave Thomas committed Oct 10, 2018
1 parent 65126cc commit 21964ec
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Fantomas/CodeFormatterImpl.fs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,10 @@ let isValidFSharpCode formatContext =

let formatWith ast formatContext config =
let moduleName = Path.GetFileNameWithoutExtension formatContext.FileName
let input = Some formatContext.Source
let input =
if String.IsNullOrWhiteSpace formatContext.Source then None
else Some formatContext.Source

// Use '\n' as the new line delimiter consistently
// It would be easier for F# parser
let sourceCode = defaultArg input String.Empty
Expand Down

0 comments on commit 21964ec

Please sign in to comment.