diff --git a/src/Annotations.cs b/src/Annotations.cs index ddb5754..2bcaef5 100644 --- a/src/Annotations.cs +++ b/src/Annotations.cs @@ -768,6 +768,7 @@ public PathReferenceAttribute([NotNull, PathReference] string basePath) /// Text inside these comments is added as source code when the template is applied. Template parameters /// can be used either as additional method parameters or as identifiers wrapped in two '$' signs. /// Use the attribute to specify macros for parameters. + /// The expression to be used in the expansion can be adjusted by the parameter. /// /// /// In this example, the 'forEach' method is a source template available over all values @@ -783,7 +784,27 @@ public PathReferenceAttribute([NotNull, PathReference] string basePath) /// [AttributeUsage(AttributeTargets.Method)] [Conditional("JETBRAINS_ANNOTATIONS")] - public sealed class SourceTemplateAttribute : Attribute { } + public sealed class SourceTemplateAttribute : Attribute + { + /// + /// Allows specifying which expression to capture for template execution if more than one present on the expansion. + /// If not specified, Inner is assumed. + /// + public SourceTemplateTargetExpression Target { get; set; } + } + /// + /// Provides a value for the to define how to capture + /// the expression at the point of expansion + /// + public enum SourceTemplateTargetExpression + { + /// Selects inner expression + /// _args = args.{caret} captures args + Inner = 0, + /// Selects outer expression + /// _args = args.{caret} captures whole assignment + Outer = 1 + } /// /// Allows specifying a macro for a parameter of a source template.