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

Error while formatting Fantomas unit test with compiler define #761

Closed
nojaf opened this issue Apr 17, 2020 · 0 comments
Closed

Error while formatting Fantomas unit test with compiler define #761

nojaf opened this issue Apr 17, 2020 · 0 comments
Assignees

Comments

@nojaf
Copy link
Contributor

nojaf commented Apr 17, 2020

Issue created from fantomas-ui

There is an exception in the tokenizer with this snippet.

Code

[<Test>]
let ``should keep compiler directives``() =
    formatSourceString false """
#if INTERACTIVE
#load "../FSharpx.TypeProviders/SetupTesting.fsx"
SetupTesting.generateSetupScript __SOURCE_DIRECTORY__
#load "__setup__.fsx"
#endif
"""  config
    |> should equal """#if INTERACTIVE
#load "../FSharpx.TypeProviders/SetupTesting.fsx"
SetupTesting.generateSetupScript __SOURCE_DIRECTORY__
#load "__setup__.fsx"
#endif
"""

Error

Exception: The input list was empty. (Parameter 'list') Stack Trace:    at Microsoft.FSharp.Collections.ListModule.Tail[T](FSharpList`1 list) in E:\A\_work\130\s\src\fsharp\FSharp.Core\list.fs:line 128
   at Fantomas.TokenParser.getDefineExprs@164-1.Invoke(Tuple`2 tupledArg) in /build/.deps/fantomas/src/Fantomas/TokenParser.fs:line 175
   at Microsoft.FSharp.Collections.ListModule.Fold[T,TState](FSharpFunc`2 folder, TState state, FSharpList`1 list) in E:\A\_work\130\s\src\fsharp\FSharp.Core\list.fs:line 221
   at Fantomas.TokenParser.getDefineExprs(String sourceCode) in /build/.deps/fantomas/src/Fantomas/TokenParser.fs:line 164
   at Fantomas.TokenParser.getOptimizedDefinesSets(String sourceCode) in /build/.deps/fantomas/src/Fantomas/TokenParser.fs:line 181
   at Fantomas.CodeFormatterImpl.parse(FSharpChecker checker, FSharpParsingOptions parsingOptions, FormatContext _arg1)
   at Server.format@60-10.Invoke(Unit unitVar0) in /build/src/Server/Server.fs:line 60
   at Server.Result.attempt[a](FSharpFunc`2 f) in /build/src/Server/Server.fs:line 24

Options

Fantomas Next - 3.3.0-4/8/2020

Name Value
IndentOnTryWith false
IndentSpaceNum 4
KeepNewlineAfter false
MaxIfThenElseShortWidth 40
PageWidth 120
ReorderOpenDeclaration false
SemicolonAtEndOfLine false
SpaceAfterComma true
SpaceAfterSemicolon true
SpaceAroundDelimiter true
SpaceBeforeClassConstructor false
SpaceBeforeColon false
SpaceBeforeLowercaseInvocation true
SpaceBeforeMember false
SpaceBeforeParameter true
SpaceBeforeSemicolon false
SpaceBeforeUppercaseInvocation false
StrictMode false
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

No branches or pull requests

1 participant