Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Export in combinantion with setter cause very weird behaviour

オープン
#361 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
65/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
devtools

調査の方向性

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

GDQuest/GDScript-formatter のほかの issue

GDQuest/GDScript-formatter の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。