Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
@GodotPropertysupports a custom property name but does not allow scripts to specifyhintorhintString.The generator already infers hints for certain types, such as Node subclasses, Resources, and typed lists. However, users cannot customize these hints or provide additional inspector settings, such as a numeric range.
Although
PropertyInfoalready supports both fields, there is no way to configure them through the annotation.Proposed solution
Add optional
hintandhintStringparameters toGodotPropertyand update the generator to pass them to the generatedDartPropertyInfo.For example:
This provides Godot with the metadata needed to display a numeric range from 0 to 1000 with a step of 10 in the inspector.
Each parameter overrides its corresponding inferred value independently:
PropertyHint.noneexplicitly disables an inferred hint.hintStringexplicitly clears the inferred string.The generator also escapes hint strings so quotes, backslashes, dollar signs, and control characters are preserved safely in the generated Dart code.
Existing annotations remain compatible without changes.
Validation
Automated tests
Added 9 tests that run the actual builder and verify:
PropertyHint.noneand an empty hint string.The generated Dart is also checked for syntax errors.
All 9 tests pass. Static analysis passes for the generator and tests.
Run the tests from
src/dart/godot_dart_build:dart test test/property_hints_test.dartThe test command and a manual inspector verification procedure are documented in the package README.
Manual testing
2026-11-04.18-54-52.mp4
Tested with Godot 4.4 on Linux, using the Compatibility renderer inside a DevContainer. The test project uses the local packages from this branch.
For
Player.speed, configured with the range annotation shown above, verified that:Fixes #23