Skip to content

feat: Indent backslash continuation lines according to style guide#218

Open
dmlary wants to merge 1 commit intoGDQuest:mainfrom
dmlary:indent-line-continuation
Open

feat: Indent backslash continuation lines according to style guide#218
dmlary wants to merge 1 commit intoGDQuest:mainfrom
dmlary:indent-line-continuation

Conversation

@dmlary
Copy link
Copy Markdown

@dmlary dmlary commented Apr 6, 2026

Please check if the PR fulfills these requirements:

  • The commit message follows our guidelines.
    • Where are these guidelines? They're not in the README.md, there's no CONTRIBUTORS.md
  • For bug fixes and features:
    • You tested the changes.

Related issue (if applicable): #180

What kind of change does this PR introduce?

Feature, implement proper line continuation indention.
From gdscript style guide1:

Use 2 indent levels to distinguish continuation lines from regular code blocks.

Does this PR introduce a breaking change?

It does change the indentation of one existing test. I don't consider that breaking, but it's unclear.

New feature or change

What is the current behavior?
Currently the formatter indents continuation lines to the same level as the first line:

func test(thing):
    thing.calling(1) \
    .a(12314) \
    .long() \
    .chain("a string breaks things") \
    .of() \
    .functions()

What is the new behavior?

With this change, continuation lines (joined with a backslash) are formatted with double indention:

func test(thing):
    thing.calling(1) \
            .a(12314) \
            .long() \
            .chain("a string breaks things") \
            .of() \
            .functions()

Other information

Footnotes

  1. https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_styleguide.html#indentation

From gdscript style guide[^1]:
> Use 2 indent levels to distinguish continuation lines from regular code blocks.

Currently the formatter indents continuation lines to the same level as
the first line:

```gdscript
func test(thing):
    thing.calling(1) \
    .a(12314) \
    .long() \
    .chain("a string breaks things") \
    .of() \
    .functions()
```

With this change, continuation lines (joined with a backslash) are
formatted with double indention:

```gdscript
func test(thing):
    thing.calling(1) \
            .a(12314) \
            .long() \
            .chain("a string breaks things") \
            .of() \
            .functions()
```

fixes GDQuest#180

[^1]: https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_styleguide.html#indentation
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