Add completion contributor for Bukkit event handlers#2613
Add completion contributor for Bukkit event handlers#2613Leguan16 wants to merge 5 commits intominecraft-dev:devfrom
Conversation
|
That's cool |
Earthcomputer
left a comment
There was a problem hiding this comment.
In addition to my specific comments:
- Please make sure to include license headers in all files.
- The constants (inside the companion objects) should go in
BukkitConstants. I believe some of them may already be there.
|
|
||
| val eventNameFilter = prefix.substring(2).lowercase() | ||
|
|
||
| ClassInheritorsSearch.search(eventBaseClass, scope, true) |
There was a problem hiding this comment.
This looks expensive. However it's not so easy to cache effectively because the easiest way to do that is using the PSI modification count as the cache key, and since you're in a completion provider that is changing on every keystroke. Leave it as it is for now.
3d708a9 to
f8e9e4f
Compare
|
I think i addressed everything in the requested changes. For the editable template I am not familiar enough with Kotlin to add this and currently don't have the time for it. If someone else wants to take a look feel free to do so. If there is anything else that needs to be changed let me know. |
|
Alright Strokkur added an editable live template so the auto completed method is now fully customizable. it-works.mp4I think - from my side - this is now ready for testing and another review. Let me know if you want anything changed. |
Adds a completion contributor for Bukkit event handlers.
It only works in a class that implements
org.bukkit.event.Listener.It uses templates to generate the method and provide opportunity to change method name and parameter name.
Screen.Recording.2026-04-21.192030.mp4
I initially created this as a poc after someone (Strokkur) posted a video of him doing something similar and wanted to try if i can implement the same logic using the plugin SDK.
If this ends up getting added we can also add Strokkur as co-author for the idea if he wants to, i don't mind that.