-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.Resolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
Description
Summary of the new feature / enhancement
There's a lot of boiler plate in experimental features, it'd be nice to have a source generator which takes this code:
NOTE: Of course this would only benefit folks working on this repo specifically, but it would greatly simplify adding experimental features in the engine and leave less room for typos/missed files.
public partial class ExperimentalFeature
{
// Probably default to this
[Experiment(Targets = ExperimentTarget.Windows | ExperimentTarget.Linux)]
private static readonly ExperimentalFeature PSDoSomething = new ExperimentalFeature(
nameof(PSDoSomething),
"The description for the feature");
[Experiment(Targets = ExperimentTarget.Linux)]
private static readonly ExperimentalFeature PSDoSomething2 = new ExperimentalFeature(
nameof(PSDoSomething2),
"The description for the feature");
}and have it generate:
public partial class ExperimentalFeature
{
internal static bool IsPSDoSomethingEnabled => EnabledExperimentalFeatureNames.Contains(nameof(PSDoSomething));
internal static bool IsPSDoSomething2Enabled => EnabledExperimentalFeatureNames.Contains(nameof(PSDoSomething2));
// Replacing the manual bit currently in the static ctor
private static ExperimentalFeature[] CreateFeatureList()
=> new[]
{
PSDoSomething,
PSDoSomething2,
};
}and
// experimental-feature-linux.json
[
"PSDoSomething",
"PSDoSomething2"
]// experimental-feature-windows.json
[
"PSDoSomething",
]Proposed technical implementation details (optional)
No response
rkeithhill
Metadata
Metadata
Assignees
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.Resolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime