Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting Program.fs with --check fails #869

Closed
nojaf opened this issue May 26, 2020 · 0 comments · Fixed by #874
Closed

Formatting Program.fs with --check fails #869

nojaf opened this issue May 26, 2020 · 0 comments · Fixed by #874

Comments

@nojaf
Copy link
Contributor

nojaf commented May 26, 2020

Command line bug:
I tried to format Program.fs.
This worked fine with:

❯ dotnet fantomas  --config .\fantomas-config.json .\EventSourced\Program.fs
Processing .\EventSourced\Program.fs
.\EventSourced\Program.fs has been written.

but fails with --check.

dotnet fantomas  --config .\fantomas-config.json .\EventSourced\Program.fs --check
error: Failed to format .\EventSourced\Program.fs: Fantomas.FormatConfig+FormatException: Parsing failed with errors: [|.\EventSourced\Program.fs (1,1)-(2,1) parse error Files in libraries or multiple-file applications must begin with a namespace or module declaration, e.g. 'namespace SomeNamespace.SubNamespace' or 'module SomeNamespace.SomeModule'. Only the last source file of an application may omit such a declaration.|]
And options: { SourceFiles = [|".\EventSourced\Program.fs"|]
  ConditionalCompilationDefines = []
  ErrorSeverityOptions = { WarnLevel = 3
                           GlobalWarnAsError = false
                           WarnOff = []
                           WarnOn = []
                           WarnAsError = []
                           WarnAsWarn = [] }
  IsInteractive = false
  LightSyntax = None
  CompilingFsLib = false
  IsExe = false }
   at Fantomas.CodeFormatterImpl.parse@61-2.Invoke(FSharpParseFileResults _arg2) in C:\Users\nojaf\Projects\fantomas\src\Fantomas\CodeFormatterImpl.fs:line 66
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 417
   at <StartupCode$FSharp-Compiler-Service>.$Service.ParseFile@423-3.Invoke(AsyncActivation`1 ctxt) in C:\projects\fsharp-compiler-service\src\fsharp\service\service.fs:line 423
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 109
.\EventSourced\Program.fs needs formatting
nojaf added a commit to nojaf/fantomas that referenced this issue May 29, 2020
@nojaf nojaf closed this as completed in #874 Jun 1, 2020
nojaf added a commit that referenced this issue Jun 1, 2020
* Renamed file in --check mode. Fixes #869

* Fixed failing check test

* Removed unused value

* Fix failing check test.

* Update to alpha-007
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant