Skip to content

[SR-15529] swift-format increases indent of multi-line string literals when using tabs for indentation #302

@saagarjha

Description

@saagarjha
Previous ID SR-15529
Radar None
Original Reporter @saagarjha
Type Bug
Environment

.swift-format:

{
    "indentation": {
        "tabs": 1
    },
}

$ swift-format -v
0.50500.0
Additional Detail from JIRA
Votes 0
Component/s swift-format
Labels Bug
Assignee None
Priority Medium

md5: 59a5b2a30254b00568ce72e4b59f40db

Issue Description:

On this code (Note, the indentation is a literal tab)

let string = """
    Hello, this is a test string. \
    Here's another line.
    """

I'd expect this to be idempotent, but swift-format increases the indentation each time it runs:

let string = """
        Hello, this is a test string. \
        Here's another line.
        """

Activity

transferred this issue fromswiftlang/swifton May 9, 2022
matej-io

matej-io commented on Jul 9, 2022

@matej-io

I have the same issue, I use VSCode and I have set format on save, so each time I save the swift file with the multi-line string it increases the indent by 1 tab.

miku1958

miku1958 commented on Sep 28, 2022

@miku1958

Same issue, please fix it! thanks

hi-kumar

hi-kumar commented on Jun 26, 2023

@hi-kumar

I made a local fix (+unit test) for this issue on top of the 508.0.0 release, but when I was trying to prepare a pull request I noticed this issue doesn't repro on main branch anymore. So, I guess we just wait for the next full release.

ahoppen

ahoppen commented on Apr 23, 2024

@ahoppen
Member

Tracked in Apple’s issue tracker as rdar://126948240

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @matej-io@ahoppen@hi-kumar@saagarjha@miku1958

        Issue actions

          [SR-15529] swift-format increases indent of multi-line string literals when using tabs for indentation · Issue #302 · swiftlang/swift-format