feat: Indent backslash continuation lines according to style guide#218
Open
dmlary wants to merge 1 commit intoGDQuest:mainfrom
Open
feat: Indent backslash continuation lines according to style guide#218dmlary wants to merge 1 commit intoGDQuest:mainfrom
dmlary wants to merge 1 commit intoGDQuest:mainfrom
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please check if the PR fulfills these requirements:
Related issue (if applicable): #180
What kind of change does this PR introduce?
Feature, implement proper line continuation indention.
From gdscript style guide1:
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:
What is the new behavior?
With this change, continuation lines (joined with a backslash) are formatted with double indention:
Other information
Footnotes
https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_styleguide.html#indentation ↩