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

Exception caused by long line over 80 characters including method calling and member indexing #2761

Closed
1 of 3 tasks
clkbug opened this issue Feb 2, 2023 · 3 comments · Fixed by #2764
Closed
1 of 3 tasks
Assignees

Comments

@clkbug
Copy link
Contributor

clkbug commented Feb 2, 2023

Issue created from fantomas-online

Code

x().y[0].zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

Error

System.Exception: Expected dot in chain at this point
   at Fantomas.Core.CodePrinter.genIndentedLinks@1104(Boolean lastLinkWasSimple, FSharpList`1 links, Context ctx) in /_//src/Fantomas.Core/CodePrinter.fs:line 1131
   at Fantomas.Core.CodePrinter.genIndentedLinks@1104-1.Invoke(Boolean lastLinkWasSimple, FSharpList`1 links, Context ctx)
   at Fantomas.Core.Context.op_PlusGreater(FSharpFunc`2 ctx, FSharpFunc`2 f, Context x) in /_//src/Fantomas.Core/Context.fs:line 425
   at Fantomas.Core.Context.op_PlusGreater(FSharpFunc`2 ctx, FSharpFunc`2 f, Context x) in /_//src/Fantomas.Core/Context.fs:line 425
   at Fantomas.Core.Context.op_PlusGreater(FSharpFunc`2 ctx, FSharpFunc`2 f, Context x) in /_//src/Fantomas.Core/Context.fs:line 425
   at Fantomas.Core.Context.col[T](FSharpFunc`2 f', IEnumerable`1 c, FSharpFunc`2 f, Context ctx) in /_//src/Fantomas.Core/Context.fs:line 458
   at Fantomas.Core.CodePrinter.genFile@3662-4.Invoke(Context ctx)
   at Fantomas.Core.Context.op_PlusGreater(FSharpFunc`2 ctx, FSharpFunc`2 f, Context x) in /_//src/Fantomas.Core/Context.fs:line 425
   at Fantomas.Core.Context.op_PlusGreater(FSharpFunc`2 ctx, FSharpFunc`2 f, Context x) in /_//src/Fantomas.Core/Context.fs:line 425
   at Fantomas.Core.CodeFormatterImpl.formatAST(ParsedInput ast, FSharpOption`1 sourceText, FormatConfig config, FSharpOption`1 cursor) in /_//src/Fantomas.Core/CodeFormatterImpl.fs:line 74
   at Fantomas.Core.CodeFormatterImpl.formatDocument@89-3.Invoke(Unit unitVar) in /_//src/Fantomas.Core/CodeFormatterImpl.fs:line 89
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2) in D:\a\_work\1\s\src\FSharp.Core\async.fs:line 508
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in D:\a\_work\1\s\src\FSharp.Core\async.fs:line 112

Problem description

The long member variable is not the cause.
This problem also arise with short name variables chaining, such as x().y[0].z.z.z.z

Extra information

  • The formatted result breaks my code.
  • The formatted result gives compiler warnings.
  • I or my company would be willing to help fix this.

Options

Fantomas v5.2 branch at 1/1/1990

Default Fantomas configuration

Did you know that you can ignore files when formatting from fantomas-tool or the FAKE targets by using a .fantomasignore file?

@nojaf
Copy link
Contributor

nojaf commented Feb 3, 2023

Hello, thank you for reporting this issue.
I'll take a look at this as this is very recent code.

@nojaf nojaf self-assigned this Feb 3, 2023
@nojaf nojaf linked a pull request Feb 3, 2023 that will close this issue
@nojaf
Copy link
Contributor

nojaf commented Feb 4, 2023

This fix is available in https://www.nuget.org/packages/fantomas/5.2.1.

@clkbug
Copy link
Contributor Author

clkbug commented Feb 5, 2023

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants