Export in combinantion with setter cause very weird behaviour
まだ誰も着手していません。
評価
調査の方向性
Look at the formatting logic for @export annotations combined with property setters in GDScript. The issue shows the formatter cycles between different layouts. Start by finding where export statements are parsed and formatted, likely in a module handling annotations or property declarations. Run the formatter on the provided code snippets to observe the non-deterministic behavior, then trace through the formatting decisions to see why it doesn't stabilize.
索引モデルが issue の本文から書いたものです。
説明
Ok, this is a really strange one.
The reformatter seems to be non deterministic in some cases.
Below I write a step by step guide to reproduce. I think that's best to follow through.
My initial code is:
@export_range(0., 500., .1, "or_greater", "suffix:m")
var max_distance_test: float = 200.:
set(value):
max_distance_test = value
Call reformatter and it changes it to:
@export_range(0., 500., .1, "or_greater", "suffix:m") var max_distance_test: float = 200.:
set(value):
max_distance_test = value
Call reformatter again and it changes it to:
@export_range(
0.,
500.,
.1,
"or_greater",
"suffix:m",
) var max_distance_test: float = 200.:
set(value):
max_distance_test = value
While the last one looks plain ugly, I think the initial one should have been already correct.
If the reformatting is indeed desired, it should have stopped after the first iteration, because the line length is not reached yet.
If I take the last one and simply add a line break before var:
@export_range(
0.,
500.,
.1,
"or_greater",
"suffix:m",
)
var max_distance_test: float = 200.:
set(value):
max_distance_test = value
Call reformatter again and it changes it back to the second iteration:
@export_range(0., 500., .1, "or_greater", "suffix:m") var max_distance_test: float = 200.:
set(value):
max_distance_test = value
From where a simple reformat call again brings us back to the ugly one.
In my script there are a bunch of such properties, therefore it is quite annoying that the reformatting can not decide on a layout.
Further more, any property without setter is left alone.
- 主要言語
- Rust
- スター
- 458
- フォーク
- 40
- 平均マージ
- 1日 15時間
- マージ済み PR(30日)
- 4
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
GDQuest/GDScript-formatter のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
GDQuest/GDScript-formatter#362 · コメント 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
GDQuest/GDScript-formatter#359 · コメント 9 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
GDQuest/GDScript-formatter#327 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 58/100
GDQuest/GDScript-formatter#360 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
GDQuest/GDScript-formatter#354 · コメント 2 件 ·
GDQuest/GDScript-formatter の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
bug core
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
-
JIT-compiled number -> Decimal conversion silently overflows instead of raising DECIMAL_OVERFLOW オープンfuzz
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
ClickHouse/ClickHouse#122114 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
linebender/vello_svg#90 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100