Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix custom classes hint string #678

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class NodeTypeHintStringGenerator(
registeredProperty: RegisteredProperty
) : PropertyHintStringGenerator<PropertyHintAnnotation>(registeredProperty) {
override fun getHintString(): String {
return registeredProperty.type.baseGodotType()?.fqName?.substringAfterLast(".") ?: ""
// we first try to use the registered class name in case it's a user type extending a godot type
// if that is not the case (null) we get the simple name instead
return registeredProperty.type.registeredName() ?: registeredProperty.type.baseGodotType()?.fqName?.substringAfterLast(".") ?: ""
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
package godot.entrygenerator.generator.hintstring

import godot.entrygenerator.EntryGenerator
import godot.entrygenerator.ext.baseGodotType
import godot.entrygenerator.model.PropertyHintAnnotation
import godot.entrygenerator.model.RegisteredProperty

class ResourceHintStringGenerator(
registeredProperty: RegisteredProperty
) : PropertyHintStringGenerator<PropertyHintAnnotation>(registeredProperty) {

override fun getHintString(): String = registeredProperty.type.fqName.substringAfterLast(".")
override fun getHintString(): String {
// we first try to use the registered class name in case it's a user type extending a godot type
// if that is not the case (null) we get the simple name instead
return registeredProperty.type.registeredName() ?: registeredProperty.type.fqName.substringAfterLast(".")
}
}
Loading