@@ -19,11 +19,11 @@ public static IEnumerable<string> GetLines(this string text)
19
19
/// </summary>
20
20
public static Range ToRange ( this IScriptExtent extent )
21
21
{
22
- return new Range (
23
- extent . StartLineNumber ,
24
- extent . StartColumnNumber ,
25
- extent . EndLineNumber ,
26
- extent . EndColumnNumber ) ;
22
+ return new Range (
23
+ extent . StartLineNumber ,
24
+ extent . StartColumnNumber ,
25
+ extent . EndLineNumber ,
26
+ extent . EndColumnNumber ) ;
27
27
}
28
28
29
29
public static ParameterAst [ ] GetParameterAsts (
@@ -59,7 +59,7 @@ public static AttributeAst GetCmdletBindingAttributeAst(this ParamBlockAst param
59
59
60
60
foreach ( var attributeAst in attributeAsts )
61
61
{
62
- if ( attributeAst != null && attributeAst . IsCmdletBindingAttributeAst ( ) )
62
+ if ( attributeAst != null && attributeAst . IsCmdletBindingAttributeAst ( ) )
63
63
{
64
64
return attributeAst ;
65
65
}
@@ -72,5 +72,27 @@ public static bool IsCmdletBindingAttributeAst(this AttributeAst attributeAst)
72
72
{
73
73
return attributeAst . TypeName . GetReflectionAttributeType ( ) == typeof ( CmdletBindingAttribute ) ;
74
74
}
75
+
76
+ public static NamedAttributeArgumentAst GetSupportsShouldProcessAst ( this AttributeAst attributeAst )
77
+ {
78
+ if ( ! attributeAst . IsCmdletBindingAttributeAst ( )
79
+ || attributeAst . NamedArguments == null )
80
+ {
81
+ return null ;
82
+ }
83
+
84
+ foreach ( var namedAttrAst in attributeAst . NamedArguments )
85
+ {
86
+ if ( namedAttrAst != null
87
+ && namedAttrAst . ArgumentName . Equals (
88
+ "SupportsShouldProcess" ,
89
+ StringComparison . OrdinalIgnoreCase ) )
90
+ {
91
+ return namedAttrAst ;
92
+ }
93
+ }
94
+
95
+ return null ;
96
+ }
75
97
}
76
98
}
0 commit comments