@@ -132,15 +132,22 @@ private List<CorrectionExtent> GetCorrections(
132132 correctionExtents . Add ( GetCorrectionToRemoveParam ( confirmIndex , parameterAsts ) ) ;
133133 }
134134
135- AttributeAst attributeAst ;
135+ AttributeAst attributeAst = paramBlockAst . GetCmdletBindingAttributeAst ( ) ;
136136
137137 // check if it has cmdletbinding attribute
138- if ( TryGetCmdletBindingAttribute ( paramBlockAst , out attributeAst ) )
138+ if ( attributeAst != null )
139139 {
140140 NamedAttributeArgumentAst shouldProcessAst = attributeAst . GetSupportsShouldProcessAst ( ) ;
141141 if ( shouldProcessAst != null )
142142 {
143-
143+ ExpressionAst argAst ;
144+ if ( ! shouldProcessAst . IsTrue ( out argAst )
145+ && argAst != null )
146+ {
147+ // SupportsShouldProcess is set to something other than $true.
148+ // Set it to $true
149+ correctionExtents . Add ( GetCorrectionsToSetShouldProcessToTrue ( argAst ) ) ;
150+ }
144151 }
145152 else
146153 {
@@ -198,6 +205,17 @@ private List<CorrectionExtent> GetCorrections(
198205 return result ;
199206 }
200207
208+ private CorrectionExtent GetCorrectionsToSetShouldProcessToTrue ( ExpressionAst argAst )
209+ {
210+ return new CorrectionExtent (
211+ argAst . Extent . StartLineNumber ,
212+ argAst . Extent . EndLineNumber ,
213+ argAst . Extent . StartColumnNumber ,
214+ argAst . Extent . EndColumnNumber ,
215+ "$true" ,
216+ argAst . Extent . File ) ;
217+ }
218+
201219 private CorrectionExtent GetCorrectionToAddParamBlock (
202220 FunctionDefinitionAst funcDefnAst ,
203221 ParameterAst [ ] parameterAsts )
@@ -281,14 +299,6 @@ private CorrectionExtent Normalize(
281299 correctionExtent . Description ) ;
282300 }
283301
284- private static bool TryGetCmdletBindingAttribute (
285- ParamBlockAst paramBlockAst ,
286- out AttributeAst attributeAst )
287- {
288- attributeAst = paramBlockAst . GetCmdletBindingAttributeAst ( ) ;
289- return attributeAst != null ;
290- }
291-
292302 private static CorrectionExtent GetCorrectionToAddAttribute ( ParamBlockAst paramBlockAst )
293303 {
294304 return new CorrectionExtent (
0 commit comments