Closed Amphaal closed 1 year ago
Parsing the source code will be difficult as slang does not know where the file is located (it may be in another package), but slang could infer the enum values from the translation files
Since 3.19.0
, you can leave out the enum
values.
Motivation Since the introduction of enhanced enums in Dart 2.17 (https://dart.dev/language/enums#declaring-enhanced-enums), associating metadata and custom behavior to enums is a common pattern, hence dicouraging using generator tools to generate enums. As Slang allows translations of existing enums via
imports
/generate_enum
, we still need to explicitly list again all enums values incontexts.[existing_enum].enum
, which naively seems redundant in cases where we need all enums values to be translated (which, IMO, represents the majority of cases).Developer Experience Could we consider, instead of:
... just do:
... and let slang search for
UserType
in imported dart files + check for presence of all expected translations based oncontexts.[existing_enum].paths
/ auto-detected paths ?