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

Fix indentation of the closing quotes of a multiline string literal in a variable assignment #1261

Conversation

paul-dingemans
Copy link
Collaborator

Description

Fix indentation below:

val bar = """
    some text
         some more text
"""

to

val bar = """
    some text
         some more text
    """

However, above might be a debatable choice. Therefore I left following TODO in a test:

        // TODO: What is the proper way to place the opening and closing quotes of a multi line string value? Note that
        //  the actual content of the multi line string is never been changed as required by ktlint maintainers
        //     val foo =
        //        """
        //        line1
        //        line2
        //        """
        //  or
        //     val foo = """
        //        line1
        //        line2
        //        """
        //  or
        //     val foo = """
        //     line1
        //     line2
        //     """
        //  or
        //     val foo = """
        //        line1
        //        line2
        //     """
        // First option would be most in line with function parameter. Second option is also acceptable. Third option
        // (previous behavior) is not logical as there is no continuation kind of indent visible. Last option is not in
        // sync with function parameter.

I would like your opinion about it, so that I can finalize this PR.

Checklist

  • tests are added
  • CHANGELOG.md is updated

Paul Dingemans added 2 commits October 27, 2021 20:39
# Conflicts:
#	ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/IndentationRule.kt
#	ktlint-ruleset-standard/src/test/kotlin/com/pinterest/ktlint/ruleset/standard/IndentationRuleTest.kt
@paul-dingemans paul-dingemans deleted the multiline-string-indent-in-property-value branch October 30, 2021 10:13
@paul-dingemans paul-dingemans restored the multiline-string-indent-in-property-value branch October 30, 2021 10:56
@paul-dingemans
Copy link
Collaborator Author

Replaced with #1262

@paul-dingemans paul-dingemans deleted the multiline-string-indent-in-property-value branch October 30, 2021 15:12
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.

1 participant