fslang-suggestions icon indicating copy to clipboard operation
fslang-suggestions copied to clipboard

Allow more undentation for tuples and dot-access (or give indentation warning instead of error)

Open Happypig375 opened this issue 6 months ago • 3 comments

I propose we fix these two inconsistencies with indentation

let r = (task {
                (),
                (), // go left as much as you want, can't go right
                ()
       }) // go right as much as you want, can't go left more than opening ( IF we have .Result below. remove .Result below and it is OK again
         .Result

The existing way of approaching this problem in F# is experiment with indentation until errors go away.

Pros and Cons

The advantage of making this adjustment to F# is less unexpected errors with indentation

The disadvantage of making this adjustment to F# is implementation complexity in the compiler.

Extra information

Estimated cost (XS, S, M, L, XL, XXL): M

Related suggestions: https://github.com/fsharp/fslang-suggestions/issues?q=indent

Affidavit (please submit!)

Please tick these items by placing a cross in the box:

  • [x] This is not a question (e.g. like one you might ask on StackOverflow) and I have searched StackOverflow for discussions of this issue
  • [x] This is a language change and not purely a tooling change (e.g. compiler bug, editor support, warning/error messages, new warning, non-breaking optimisation) belonging to the compiler and tooling repository
  • [x] This is not something which has obviously "already been decided" in previous versions of F#. If you're questioning a fundamental design decision that has obviously already been taken (e.g. "Make F# untyped") then please don't submit it
  • [x] I have searched both open and closed suggestions on this site and believe this is not a duplicate

Please tick all that apply:

  • [x] This is not a breaking change to the F# language design
  • [x] I or my company would be willing to help implement and/or test this

For Readers

If you would like to see this issue implemented, please click the :+1: emoji on this issue. These counts are used to generally order the suggestions by engagement.

Happypig375 avatar Jul 08 '25 16:07 Happypig375

Related:

  • This logic in the parentheses analyzer.
  • Other issues indicating that more sophisticated offsides tracking would be useful: https://github.com/dotnet/fsharp/issues/16966, https://github.com/dotnet/fsharp/issues/16999.

brianrourkeboll avatar Jul 08 '25 17:07 brianrourkeboll

A description of what the mentioned inconsistencies are would be useful. Is each comment mapping to an inconsistency (if so, what) or is the inconsistency between the two comments? And then a suggestion for how to resolve it: what code which the compiler allows now should not be allowed, and/or what code which the compiler disallows now should be allowed?

charlesroddie avatar Aug 10 '25 21:08 charlesroddie

I do not see why not - I think it first needs a better level of detail (e.g. level of detail similar to the one here https://github.com/fsharp/fslang-design/blob/main/FSharp-6.0/FS-1108-undentation-frenzy.md) to better understand/see the real implications.

T-Gro avatar Aug 25 '25 14:08 T-Gro