fantomas icon indicating copy to clipboard operation
fantomas copied to clipboard

match-with moving with to a newline causing an issue with SDK 5

Open AnasMhaishHNC opened this issue 1 year ago • 2 comments

Issue created from fantomas-online

Code

let r = match m.ThisIsMadeLongToReproduceTheIssue with
        | true -> OK
        | false -> None

let r = match m.ThisIsMadeLongToReproduceTheIssueeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee with
        | true -> OK
        | false -> None

Result

let r =
    match m.ThisIsMadeLongToReproduceTheIssue with
    | true -> OK
    | false -> None

let r =
    match
        m.ThisIsMadeLongToReproduceTheIssueeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
    with
    | true -> OK
    | false -> None

Problem description

When using SDK .Net 5, we are getting the following compiler error

error FS0010: Incomplete structured construct at or before this point in expression. Expected 'with' or other token. 
Possible incorrect indentation: this token is offside of context started at position. Try indenting this token further or using standard formatting conventions.

Upgrading to the latest SDK did fix the issue, however, we can't update it at the moment as it requires a lot of testing

Extra information

  • [x] The formatted result breaks my code.
  • [x] The formatted result gives compiler errors.

AnasMhaishHNC avatar Mar 15 '23 15:03 AnasMhaishHNC

Hello, thank you for your interest in this project.

Please note that Fantomas requires the latest version of the F# language to operate, and we are not able to maintain compatibility with older F# language versions that are shipped with older SDKs.

If you are currently using an older SDK and are unable to update to the latest version, it means that you will need to use an older version of Fantomas that is compatible with your SDK. Although these issues are rare, you may still be able to work around them in your code.

To provide an example, please consider the following code snippet:

Copy code
let r =
    let me = m.ThisIsMadeLongToReproduceTheIssueeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
    match me with
    | true -> OK
    | false -> None

We will provide more detailed documentation on this topic, but please note that we have no immediate plans to address this issue. Thank you for your understanding.

nojaf avatar Mar 16 '23 08:03 nojaf

Additionally .NET SDK 5 is a release that has reached End of Life and will no longer receive any security updates.

panmona avatar Mar 17 '23 08:03 panmona