Long chains with some long arguments followed by method calls or property accesses could be more harmonious
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 58/100
Research direction
Start at the parser's chain-formatting logic, which currently adds backslashes and vertically aligns chained calls when the chain is too long. Use the provided GDScript example as the reproduction case; done means preserving the unwrapped first call and keeping the trailing method calls on one line when the long arguments already force a break.
Written by the indexing model from the issue text.
Description
From a course module we're working on. Input:
tween.tween_method(
func(t: float) -> void:
if move_and_collide(start.lerp(destination, t) - global_position):
tween.kill()
_transition_to_state(State.NORMAL),
0.0, 1.0, duration
).set_trans(Hook.PULL_TRANS).set_ease(Hook.PULL_EASE)
Current output:
tween \
.tween_method(
func(t: float) -> void:
if move_and_collide(start.lerp(destination, t) - global_position):
tween.kill()
_transition_to_state(State.NORMAL),
0.0,
1.0,
duration,
) \
.set_trans(Hook.PULL_TRANS) \
.set_ease(Hook.PULL_EASE)
In this case, it's probably more readable as a result to keep the tail end of the chain after the long arguments on a single line if possible. And for the first line, we definitely want not to wrap.
The parser is seeing this as a chain too long to fit on a single line, and it tries to consistently add backslashes for vertical chains of method calls and align the property accesses/method calls vertically.
Desired output:
tween.tween_method(
func(t: float) -> void:
if move_and_collide(start.lerp(destination, t) - global_position):
tween.kill()
_transition_to_state(State.NORMAL),
0.0,
1.0,
duration,
).set_trans(Hook.PULL_TRANS).set_ease(Hook.PULL_EASE)
- Dominant language
- Rust
- Stars
- 458
- Forks
- 40
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 4
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from GDQuest/GDScript-formatter
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
GDQuest/GDScript-formatter#362 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
GDQuest/GDScript-formatter#359 · 9 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
GDQuest/GDScript-formatter#327 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
GDQuest/GDScript-formatter#361 · 3 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
GDQuest/GDScript-formatter#354 · 2 comments ·
All issues in GDQuest/GDScript-formatter
Similar issues
-
bug github_actions
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
registrystack/registry-stack#1393 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
longbridge/gpui-kit#3223 ·
-
bug engine
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
rocky-data/rocky#2181 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
oasisprotocol/oasis-sdk#2523 ·
-
[indexer] [QA] Add a focused test for the new NonRetryableError / assertSocketAlive() behavior. Openbot:ai-assisted component:indexer QA-roadmap status:untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
midnightntwrk/midnight-indexer#1557 ·