Configures how an aspect is presented in the IDE's code refactoring menu, including options for applying the aspect as a live template or as a custom attribute. This attribute is applied to aspect classes to control their editor experience.
Namespace: Metalama.Framework.Aspects
Assembly: Metalama.Framework.dll
Syntax
[AttributeUsage(AttributeTargets.Class)]
[CompileTime]
public sealed class EditorExperienceAttribute : AttributeRemarks
Use this attribute on aspect classes (types implementing IAspect) to customize how the IDE suggests and displays the aspect to users. You can control whether the aspect appears in code refactoring menus and customize the menu item titles.
Two modes of aspect application are supported:
- Live Template: The aspect is applied directly to the source code, transforming the code itself. Enable this with SuggestAsLiveTemplate.
- Custom Attribute: The aspect is applied by adding a custom attribute to the target declaration. Enable this with SuggestAsAddAttribute.
For both modes, the aspect class must have a default constructor, and the aspect's eligibility (see BuildEligibility(IEligibilityBuilder<T>)) determines which code elements can have the aspect applied.
Examples
[EditorExperience(SuggestAsLiveTemplate = true, LiveTemplateSuggestionTitle = "Logging|Add Method Logging")]
public class LogAttribute : OverrideMethodAspect
{
// Aspect implementation
}Constructors
| Name | Description |
|---|---|
| EditorExperienceAttribute() |
Properties
| Name | Description |
|---|---|
| AddAttributeSuggestionTitle | Gets or sets the title of the code refactoring menu item that applies the aspect as a custom attribute. By default, the title is |
| LiveTemplateSuggestionTitle | Gets or sets the title of the code refactoring menu item that applies the aspect as a live template. By default, the title is |
| SuggestAsAddAttribute | Gets or sets a value indicating whether the code refactoring menu should offer the possibility to apply this aspect as a custom attribute. This property is |
| SuggestAsLiveTemplate | Gets or sets a value indicating whether the code refactoring menu should offer the possibility to apply this aspect as a live template, i.e., as an action that causes the aspect to applied to
the source code itself. This property is |