cogentcore / core

A free and open source framework for building powerful, fast, and elegant 2D and 3D apps that run on macOS, Windows, Linux, iOS, Android, and the Web with a single pure Go codebase, allowing you to Code Once, Run Everywhere.
http://cogentcore.org/core
BSD 3-Clause "New" or "Revised" License
1.31k stars 71 forks source link

enumgen: support ability to extend an original enum type with new string values #970

Open rcoreilly opened 3 weeks ago

rcoreilly commented 3 weeks ago

Describe the feature

code keymap extends core keymap.Functions with new key functions. It merges its add-on maps with the default core keymaps, which obviously can only know about the original Functions enum type. Therefore, to be able to properly view etc these updated keymaps, we need to be able to extend the original Functions enum string values from a different package.

given that enum data is not exported, this would require some kind of hook that the new package calls, to merge its values into the original data structures.

@kkoreilly also said he wants to think about more generics-based enum logic, which might help with this.

This is a very general issue with any app extending keymap.Functions, and may be relevant to icons, and is a generally useful feature to support for any enum type.

Relevant code

No response

kkoreilly commented 3 weeks ago

Reminder that icons are not enums.