Consider search keywords in `CreateDialog`
Fixes https://github.com/godotengine/godot-proposals/issues/10573
Uses the search keywords defined on the class in order to improve search.
This works for any uses of the CreateDialog, such as adding a new node or creating a new resource file.
Similar to the docs search (F1), it only shows the suffix text if the name did not match the search text.
There is a weird bug when you search for whitespace, but this also was the case in 4.3 so unrelated to these changes.
Aaah, I see how localization would be an issue. I thought your proposal would be using an entirely separate system, but reusing the existing keywords is somewhat more appropriate.
Oh that's... that's such a rudimentary way to go about it. It's trying to create the class based off the whole string. So the actual class name should be store in the item's meta, instead.
I can't believe I forgot to test the actual "instantiate" functionality, whoops. Fixed and rebased!
- Rebased onto latest master (fixed conflicts)
- All concerns should be resolved now
- Fully tested all functionality again (e.g.
class_name, as well as the error case that Calinou ran into), works fine
@Calinou I totally forgot to do this simple change, sorry for the wait! ^^'
Compared to docs search, I had to reduce the score multiplier to 0.1 for keywords, due to the different nature in which the score is computed here.
CreateDialog: searching for "omni":
score of ConfirmationDialog was 0.07775999605656
score of OmniLight3D was 0.27687272429466
score of OpenXRCompositionLayerCylinder was 0.0570240020752
score of OpenXRCompositionLayerEquirect was 0.0570240020752
score of PointLight2D was 1.0 (keyword "omni")
As you can see, using 0.9 multiplier wouldn't have reduced priority enough. It seems this is due to case-sensitivity + the fact that the keyword is very short + exact matches yielding max score.
I believe this is safe to merge for 4.5...?
Thanks!