Export in combinantion with setter cause very weird behaviour
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
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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của GDQuest/GDScript-formatter
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
GDQuest/GDScript-formatter#365 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
GDQuest/GDScript-formatter#366 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 58/100
GDQuest/GDScript-formatter#360 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
GDQuest/GDScript-formatter#354 · 2 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
GDQuest/GDScript-formatter#353 · 4 bình luận ·
Tất cả issue của GDQuest/GDScript-formatter
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
swc-project/swc#12516 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
mls-rs-crypto-awslc: exact aws-lc-rs =1.16.3 pin blocks rustls security updateCó thể đã có người làm @muscariello đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
[work-item] adam-adae-worsening-emergence: conform spec.yaml to the specification style contract (REQ-1280)Có thể đã có người làm @muse-yamaa-bot đã nhận hôm nay. Đang mởwork-item
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]:设置的关于页面,“系统信息”部分排版异常Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
metasequoiaime/msime#7328 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
eclipse-opensovd/classic-diagnostic-adapter#616 ·
Maintainer thường phản hồi trong vòng 2 ngày