Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Export in combinantion with setter cause very weird behaviour

Open
#361 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
65/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
devtools

Research direction

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.

Written by the indexing model from the issue text.

Description

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.

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from GDQuest/GDScript-formatter

All issues in GDQuest/GDScript-formatter

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.