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

Config documentation #1956

Merged
merged 2 commits into from
Nov 7, 2021
Merged

Config documentation #1956

merged 2 commits into from
Nov 7, 2021

Conversation

nojaf
Copy link
Contributor

@nojaf nojaf commented Nov 7, 2021

This adds the configuration meta information to the Fantomas Daemon.
The configuration response would look like:

{
    "settings": {
        "indent_size": {
            "type": "number",
            "defaultValue": "4",
            "category": "Indentation",
            "displayName": "Indent spaces",
            "description": "Number of spaces to use for indentation"
        },
        "max_line_length": {
            "type": "number",
            "defaultValue": "120",
            "category": "Boundaries",
            "displayName": "Maximum line length",
            "description": "The column where we break to new lines"
        },
        "fsharp_semicolon_at_end_of_line": {
            "type": "boolean",
            "defaultValue": "false",
            "category": "Convention",
            "displayName": "Semicolon at end-of-line",
            "description": "Forces a semicolon to be added to the end of a line"
        },
        "fsharp_space_before_parameter": {
            "type": "boolean",
            "defaultValue": "true",
            "category": "Spacing",
            "displayName": "Before parameter"
        },
        "fsharp_space_before_lowercase_invocation": {
            "type": "boolean",
            "defaultValue": "true",
            "category": "Spacing",
            "displayName": "Before lowercase invocation"
        },
        "fsharp_space_before_uppercase_invocation": {
            "type": "boolean",
            "defaultValue": "false",
            "category": "Spacing",
            "displayName": "Before uppercase invocation"
        },
        "fsharp_space_before_class_constructor": {
            "type": "boolean",
            "defaultValue": "false",
            "category": "Spacing",
            "displayName": "Before class constructor"
        },
        "fsharp_space_before_member": {
            "type": "boolean",
            "defaultValue": "false",
            "category": "Spacing",
            "displayName": "Before member"
        },
        "fsharp_space_before_colon": {
            "type": "boolean",
            "defaultValue": "false",
            "category": "Spacing",
            "displayName": "Before colon"
        },
        "fsharp_space_after_comma": {
            "type": "boolean",
            "defaultValue": "true",
            "category": "Spacing",
            "displayName": "After comma"
        },
        "fsharp_space_before_semicolon": {
            "type": "boolean",
            "defaultValue": "false",
            "category": "Spacing",
            "displayName": "Before semicolon"
        },
        "fsharp_space_after_semicolon": {
            "type": "boolean",
            "defaultValue": "true",
            "category": "Spacing",
            "displayName": "After semicolon"
        },
        "fsharp_indent_on_try_with": {
            "type": "boolean",
            "defaultValue": "false",
            "category": "Indentation",
            "displayName": "Indent try-with"
        },
        "fsharp_space_around_delimiter": {
            "type": "boolean",
            "defaultValue": "true",
            "category": "Spacing",
            "displayName": "Around delimiter"
        },
        "fsharp_max_if_then_else_short_width": {
            "type": "number",
            "defaultValue": "40",
            "category": "Boundaries",
            "displayName": "Maximum if-then-else width"
        },
        "fsharp_max_infix_operator_expression": {
            "type": "number",
            "defaultValue": "50",
            "category": "Boundaries",
            "displayName": "Maximum infix-operator expression"
        },
        "fsharp_max_record_width": {
            "type": "number",
            "defaultValue": "40",
            "category": "Boundaries",
            "displayName": "Maximum record width"
        },
        "fsharp_max_record_number_of_items": {
            "type": "number",
            "defaultValue": "1",
            "category": "Boundaries",
            "displayName": "Maximum items in a record"
        },
        "fsharp_record_multiline_formatter": {
            "type": "multilineFormatterType",
            "defaultValue": "character_width",
            "category": "Boundaries",
            "displayName": "Multi-line formatter for records"
        },
        "fsharp_max_array_or_list_width": {
            "type": "number",
            "defaultValue": "40",
            "category": "Boundaries",
            "displayName": "Maximum array or list width"
        },
        "fsharp_max_array_or_list_number_of_items": {
            "type": "number",
            "defaultValue": "1",
            "category": "Boundaries",
            "displayName": "Maximum number of items in array/list"
        },
        "fsharp_array_or_list_multiline_formatter": {
            "type": "multilineFormatterType",
            "defaultValue": "character_width",
            "category": "Boundaries",
            "displayName": "Multi-line formatter for array/list"
        },
        "fsharp_max_value_binding_width": {
            "type": "number",
            "defaultValue": "80",
            "category": "Boundaries",
            "displayName": "Maximum value-binding width"
        },
        "fsharp_max_function_binding_width": {
            "type": "number",
            "defaultValue": "40",
            "category": "Boundaries",
            "displayName": "Maximum function-binding width"
        },
        "fsharp_max_dot_get_expression_width": {
            "type": "number",
            "defaultValue": "50",
            "category": "Boundaries",
            "displayName": "Maximum dot get expression width"
        },
        "fsharp_multiline_block_brackets_on_same_column": {
            "type": "boolean",
            "defaultValue": "false",
            "category": "Boundaries",
            "displayName": "Multiline-block brackets on same column"
        },
        "fsharp_newline_between_type_definition_and_members": {
            "type": "boolean",
            "defaultValue": "false",
            "category": "Convention",
            "displayName": "Newline between type definition and members"
        },
        "fsharp_keep_if_then_in_same_line": {
            "type": "boolean",
            "defaultValue": "false",
            "category": "Convention",
            "displayName": "Keep If-Then in same line",
            "description": "Obsolete setting, this no longer has any effect and will be removed in the next major version."
        },
        "fsharp_max_elmish_width": {
            "type": "number",
            "defaultValue": "40",
            "category": "Elmish",
            "displayName": "Maximum width for elmish syntax"
        },
        "fsharp_single_argument_web_mode": {
            "type": "boolean",
            "defaultValue": "false",
            "category": "Elmish",
            "displayName": "Single-argument web mode"
        },
        "fsharp_align_function_signature_to_indentation": {
            "type": "boolean",
            "defaultValue": "false",
            "category": "Convention",
            "displayName": "Align function signature to indentation"
        },
        "fsharp_alternative_long_member_definitions": {
            "type": "boolean",
            "defaultValue": "false",
            "category": "Convention",
            "displayName": "Alternative long member definitions"
        },
        "fsharp_multi_line_lambda_closing_newline": {
            "type": "boolean",
            "defaultValue": "false",
            "category": "Boundaries",
            "displayName": "MultiLine-lambda has closing newline"
        },
        "fsharp_disable_elmish_syntax": {
            "type": "boolean",
            "defaultValue": "false",
            "category": "Elmish",
            "displayName": "Disable support for elmish syntax"
        },
        "end_of_line": {
            "type": "endOfLineStyle",
            "defaultValue": "crlf",
            "category": "Boundaries",
            "displayName": "Line-ending style"
        },
        "fsharp_keep_indent_in_branch": {
            "type": "boolean",
            "defaultValue": "false",
            "category": "Indentation",
            "displayName": "Keep indent in branch",
            "description": "Experimental feature, use at your own risk."
        },
        "fsharp_blank_lines_around_nested_multiline_expressions": {
            "type": "boolean",
            "defaultValue": "true",
            "category": "Convention",
            "displayName": "Keep empty lines around nested multi-line expressions"
        },
        "fsharp_bar_before_discriminated_union_declaration": {
            "type": "boolean",
            "defaultValue": "false",
            "category": "Convention",
            "displayName": "Add a bar before Discriminated Union declarations"
        },
        "fsharp_strict_mode": {
            "type": "boolean",
            "defaultValue": "false",
            "category": "Convention",
            "displayName": "Strict mode",
            "description": "Pretty printing based on ASTs only.\nPlease do not use this setting for formatting hand written code!"
        }
    },
    "enumOptions": {
        "multilineFormatterType": [
            "character_width",
            "number_of_items"
        ],
        "endOfLineStyle": [
            "lf",
            "crlf"
        ]
    }
}

You cannot assume that category, displayName or description will be present as there are versions out in the wild that don't contain these fields.

@deviousasti I'm going to close #1931 in favour of this PR.
This does not mean we cannot revisit certain descriptions or other values.

@nojaf nojaf merged commit 7c1f6a9 into fsprojects:4.6 Nov 7, 2021
@nojaf nojaf deleted the config-documentation branch November 7, 2021 14:24
nojaf added a commit that referenced this pull request Nov 7, 2021
* Add documentation attribute

* Expose documentation attributes via Fantomas Daemon.

Co-authored-by: Asti <rahul.ramakumar@walmart.com>
@nojaf
Copy link
Contributor Author

nojaf commented Nov 8, 2021

@deviousasti this was published in 4.6.0-alpha-007.

@deviousasti
Copy link
Member

Thanks. I'll try it out.

nojaf added a commit that referenced this pull request Nov 9, 2021
* Add documentation attribute

* Expose documentation attributes via Fantomas Daemon.

Co-authored-by: Asti <rahul.ramakumar@walmart.com>
nojaf added a commit that referenced this pull request Nov 10, 2021
* Add documentation attribute

* Expose documentation attributes via Fantomas Daemon.

Co-authored-by: Asti <rahul.ramakumar@walmart.com>
nojaf added a commit that referenced this pull request Nov 19, 2021
* Add documentation attribute

* Expose documentation attributes via Fantomas Daemon.

Co-authored-by: Asti <rahul.ramakumar@walmart.com>
nojaf added a commit that referenced this pull request Nov 24, 2021
* Add documentation attribute

* Expose documentation attributes via Fantomas Daemon.

Co-authored-by: Asti <rahul.ramakumar@walmart.com>
nojaf added a commit that referenced this pull request Dec 4, 2021
* Add documentation attribute

* Expose documentation attributes via Fantomas Daemon.

Co-authored-by: Asti <rahul.ramakumar@walmart.com>
nojaf added a commit that referenced this pull request Dec 29, 2021
* Add documentation attribute

* Expose documentation attributes via Fantomas Daemon.

Co-authored-by: Asti <rahul.ramakumar@walmart.com>
nojaf added a commit that referenced this pull request Jan 7, 2022
* Add documentation attribute

* Expose documentation attributes via Fantomas Daemon.

Co-authored-by: Asti <rahul.ramakumar@walmart.com>
nojaf added a commit that referenced this pull request Jan 8, 2022
* Add documentation attribute

* Expose documentation attributes via Fantomas Daemon.

Co-authored-by: Asti <rahul.ramakumar@walmart.com>
nojaf added a commit that referenced this pull request Jan 8, 2022
* Add documentation attribute

* Expose documentation attributes via Fantomas Daemon.

Co-authored-by: Asti <rahul.ramakumar@walmart.com>
nojaf added a commit that referenced this pull request Jan 14, 2022
* Add documentation attribute

* Expose documentation attributes via Fantomas Daemon.

Co-authored-by: Asti <rahul.ramakumar@walmart.com>
nojaf added a commit that referenced this pull request Jan 14, 2022
* Add documentation attribute

* Expose documentation attributes via Fantomas Daemon.

Co-authored-by: Asti <rahul.ramakumar@walmart.com>
jindraivanek pushed a commit to jindraivanek/fantomas that referenced this pull request Mar 30, 2022
* Add documentation attribute

* Expose documentation attributes via Fantomas Daemon.

Co-authored-by: Asti <rahul.ramakumar@walmart.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants