Skip to content

Commit

Permalink
Fix custom classes type name (#678)
Browse files Browse the repository at this point in the history
  • Loading branch information
chippmann authored Sep 1, 2024
1 parent 6fcc792 commit a37b893
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
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(".")
}
}

0 comments on commit a37b893

Please sign in to comment.