-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
Formatting of long parameter lists #657
Comments
For the record, dotnet/docs#21690 was just merged, so now the core issue here (avoiding vanity alignment) has style guide backing. |
@cmeeren for my understanding of the guide, would the expected outcome be type RequestParser<'ctx, 'a> =
internal
{ consumedFields: Set<ConsumedFieldName>
parse: 'ctx -> Request -> Async<Result<'a, Error list>>
prohibited: ProhibitedRequestGetter list }
static member internal Create
(
consumedFields, parse: 'ctx -> Request -> Async<Result<'a, Error list>>
) : RequestParser<'ctx, 'a> =
{ consumedFields = consumedFields
parse = parse
prohibited = [] }
? |
The style guide doesn't say this explicitly, but as I interpret it, members should be indented relative to the type declaration, not the constructor/fields (which creates one extra level of indentation without any benefit and breaks consistency with how class members are indented). So this is my interpretation: type RequestParser<'ctx, 'a> =
internal
{ consumedFields: Set<ConsumedFieldName>
parse: 'ctx -> Request -> Async<Result<'a, Error list>>
prohibited: ProhibitedRequestGetter list }
static member internal Create
(
consumedFields, parse: 'ctx -> Request -> Async<Result<'a, Error list>>
) : RequestParser<'ctx, 'a> =
{ consumedFields = consumedFields
parse = parse
prohibited = [] } However, I see that:
I will seek clarification for these points (as well as the initial indentation question) back on the dotnet/docs repo. |
Thank you @cmeeren! |
@nojaf I think the question is resolved in dotnet/docs#21690. AFAIU the snippet I posted above should be correct. |
Well, I'd like Phillip to confirm here ;), so I'll wait until things are official ;) Also, should it not be: type RequestParser<'ctx, 'a> =
internal
{ consumedFields: Set<ConsumedFieldName>
parse: 'ctx -> Request -> Async<Result<'a, Error list>>
prohibited: ProhibitedRequestGetter list }
static member internal Create
(
consumedFields,
parse: 'ctx -> Request -> Async<Result<'a, Error list>>
) : RequestParser<'ctx, 'a> =
{ consumedFields = consumedFields
parse = parse
prohibited = [] } I created #1300 for the static member indentation issue. |
👍
Yes of course, my bad. I didn't notice there were two parameters. |
@nojaf that looks reasonable to me. |
Online here
Input:
Output:
I strongly dislike code that is indented far to the right to "match up", for the following reasons
I usually format it like this:
The text was updated successfully, but these errors were encountered: