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

[style-guide] Multiline base constructor call #693

Closed
nojaf opened this issue Jul 8, 2022 · 2 comments · Fixed by dotnet/docs#31498
Closed

[style-guide] Multiline base constructor call #693

nojaf opened this issue Jul 8, 2022 · 2 comments · Fixed by dotnet/docs#31498

Comments

@nojaf
Copy link
Contributor

nojaf commented Jul 8, 2022

How would the style guide envision the following inherit function calls are formatted?

type UnhandledWebException =
    inherit Exception

    new(status: WebExceptionStatus, innerException: Exception) =
        { inherit Exception(SPrintF1
                                "Backend not prepared for this WebException with Status[%i]"
                                (int status),
                            innerException) }

    new(info: SerializationInfo, context: StreamingContext) =
        { inherit Exception(info, context) }

type FieldNotFoundException<'T>(obj: 'T, field: string, specLink: string) =
    inherit SwaggerSchemaParseException(sprintf
                                            "Object MUST contain field `%s` (See %s for more details).\nObject:%A"
                                            field
                                            specLink
                                            obj)

Should the expressions after the inherit follow the same rules as https://docs.microsoft.com/en-us/dotnet/fsharp/style-guide/formatting#formatting-application-expressions?

Something like

type UnhandledWebException =
    inherit Exception

    new(status: WebExceptionStatus, innerException: Exception) =
        { inherit
            Exception(
                SPrintF1 "Backend not prepared for this WebException with Status[%i]" (int status),
                innerException
            ) }

    new(info: SerializationInfo, context: StreamingContext) = { inherit Exception(info, context) }

type FieldNotFoundException<'T>(obj: 'T, field: string, specLink: string) =
    inherit 
        SwaggerSchemaParseException(
            sprintf
                "Object MUST contain field `%s` (See %s for more details).\nObject:%A"
                field
                specLink
                obj
        )

?

Adding the extra indent and new line after inherit would allow for the "indentation flow" to be preserved.

Thoughts?

@dsyme
Copy link
Contributor

dsyme commented Sep 29, 2022

@nojaf Yes, that's ok. Approved

@dsyme
Copy link
Contributor

dsyme commented Oct 7, 2022

Thank you for doing the doc updates @nojaf !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants