Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Export in combinantion with setter cause very weird behaviour

Đã đóng
#361 4 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
65/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
devtools

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Rust
Star
468
Fork
39
Merge trung bình
6 giờ 24 phút
Pull request đã merge (30 ngày)
3

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của GDQuest/GDScript-formatter

Tất cả issue của GDQuest/GDScript-formatter

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.