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

Allow undentation for constructors #724

Open
charlesroddie opened this Issue Mar 2, 2019 · 9 comments

Comments

Projects
None yet
4 participants
@charlesroddie
Copy link

charlesroddie commented Mar 2, 2019

It's good to be able to move 4 characters to the right to get to the next level and leads to smart code where lines generally start at a indentation which is a multiple of 4. This works well with tooling (Tab/shift-tab).

However in constructors, full indentation is required. So when defining types, the length of the type name determines how far to the right inputs must be positioned:

open System
type SixAccessViolations(a:AccessViolationException,
                         b:AccessViolationException,
                         c:AccessViolationException,
                         d:AccessViolationException,
                         e:AccessViolationException,
                         f:AccessViolationException) =
    class end

Undentation is not allowed:

type SixAccessViolations(a:AccessViolationException,
        b:AccessViolationException, c:AccessViolationException,
        d:AccessViolationException, e:AccessViolationException,
        f:AccessViolationException) =
    class end

Function inputs allow undentation (and it's explicitly in the F# spec):

let sixAccessViolations =
    SixAccessViolations(accessViolation,
        accessViolation, accessViolation,
        accessViolation, accessViolation,
        accessViolation)
@cartermp

This comment has been minimized.

Copy link
Member

cartermp commented Mar 4, 2019

I would like to see this done if possible.

@dsyme

This comment has been minimized.

Copy link
Collaborator

dsyme commented Mar 9, 2019

Marked as approved. I'll try to look at this today

@dsyme

This comment has been minimized.

Copy link
Collaborator

dsyme commented Mar 9, 2019

This suggestion is implemented in Microsoft/visualfsharp#6314

@charlesroddie Any chance you could write up a brief RFC? @cartermp has broken his arm so can't type fast :/

@dsyme dsyme added the started label Mar 9, 2019

@charlesroddie

This comment has been minimized.

Copy link
Author

charlesroddie commented Mar 9, 2019

Travelling at the moment but I will give it a go in a few days.

@cartermp

This comment has been minimized.

Copy link
Member

cartermp commented Mar 9, 2019

@dsyme

This comment has been minimized.

Copy link
Collaborator

dsyme commented Mar 9, 2019

@cartermp You're not meant to be typing!

@FunctionalFirst

This comment has been minimized.

Copy link

FunctionalFirst commented Mar 11, 2019

@dsyme Only asking because I haven't seen an example of this. Will undentation of the first input be allowed? E.g.,

type SixAccessViolations(
    a:AccessViolationException,
    ...) =
@charlesroddie

This comment has been minimized.

Copy link
Author

charlesroddie commented Mar 11, 2019

@FunctionalFirst Yes and that will be a very common way to format. That's how it works with function inputs at the moment.

@dsyme

This comment has been minimized.

Copy link
Collaborator

dsyme commented Mar 12, 2019

@dsyme Only asking because I haven't seen an example of this. Will undentation of the first input be allowed?

We should double check - the test cases in the PR doesn't cover this yet https://github.com/Microsoft/visualfsharp/pull/6314/files#diff-d652333102a65f9f23289cb1d40938bbR249

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.