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

Lists passed into constructor are incorrectly indented #2754

Closed
JonCanning opened this issue Jan 31, 2023 · 1 comment · Fixed by #2783
Closed

Lists passed into constructor are incorrectly indented #2754

JonCanning opened this issue Jan 31, 2023 · 1 comment · Fixed by #2783
Labels
documentation good first issue Long hanging fruit: easy issue to get your feet wet!

Comments

@JonCanning
Copy link

Issue created from fantomas-online

Code

let testApi = TestApi[ asset1; asset2 ]

Result

let testApi =
    TestApi[asset1
            asset2]

Problem description

It should format to TestApi [ asset1; asset2 ] and it does if a space is provided between the type name and list

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 1, 2023

Hello, thanks for reaching out about this.

This actually isn't a bug but a consequence of the new F# 6 syntax.

You are indexing TestApi with the sequential expression asset1; asset2.

When putting this example in F# interactive:

Microsoft (R) F# Interactive version 12.5.0.0 for F# 7.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

For help type #help;;

> let TestApi _ = ();;
val TestApi: 'a -> unit

> TestApi[ 1; 2 ];;

  TestApi[ 1; 2 ]
  ^^^^^^^^^^^^^^^

stdin(2,1): info FS3365: The syntax 'expr1[expr2]' is used for indexing. Consider adding a type annotation to enable indexing, or if calling a function add a space, e.g. 'expr1 [expr2]'.

val it: unit = ()

You get a warning/info message about this.

Most likely you are using a newer Fantomas for an older project. So, in rare cases, the newer syntax rules clash a bit with what your compiler will tell you.

I'm going to leave this issue open, as we should cover this in our documentation.
(You are not the first to bring this up, see #2158)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation good first issue Long hanging fruit: easy issue to get your feet wet!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants