-
Notifications
You must be signed in to change notification settings - Fork 312
Description
LSP refactoring tools and LLMs have problems with the create_enum
and create_extensible_enum
macros because they aren't defined as enums e.g., Copilot will grep for "enum EnumName" and won't find it.
While the macros are handy, proc macros are just code generators. And we already will generate most of our code via Azure/typespect-rust. Thus, we should just expand the enums we have now in core and other hand-written files.
The emitter already has an issue to remove use of them: Azure/typespec-rust#611
And rather than create a proc macro as the original description here describes, as the discussion below points out: with all the "wrapping" of serde attributes we could do but probably shouldn't, we end up having to type 90% or more of the enum anyway e.g., the type declaration, the variants, serde attributes, other derives e.g., SafeDebug
, etc. We could even mark the non-unknown variants as #[safe(true)]
because they are defined values, but leave the whole type as unsafe so that the UnknownValue
isn't traced by default.
And given the complexity of writing, debugging, and maintaining a proc macro, it's just not worth it for the last 10% or less when we already use a code emitter for more code.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status