File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -179,7 +179,8 @@ private List<CorrectionExtent> GetCorrections(
179179 else
180180 {
181181 // has no cmdletbinding attribute
182- // add the attribute and supportsshouldprocess argument
182+ // hence, add the attribute and supportsshouldprocess argument
183+ correctionExtents . Add ( GetCorrectionExtent ( paramBlockAst ) ) ;
183184 }
184185 }
185186 else
@@ -238,7 +239,21 @@ private static bool TryGetCmdletBindingAttribute(
238239 return attributeAst != null ;
239240 }
240241
242+ private static CorrectionExtent GetCorrectionExtent ( ParamBlockAst paramBlockAst )
243+ {
244+
245+ string correctionText = new String ( ' ' , paramBlockAst . Extent . StartColumnNumber - 1 )
246+ + "CmdletBinding(SupportsShouldProcess)"
247+ + Environment . NewLine ;
241248
249+ return new CorrectionExtent (
250+ paramBlockAst . Extent . StartLineNumber ,
251+ paramBlockAst . Extent . EndLineNumber ,
252+ 1 ,
253+ 1 ,
254+ correctionText ,
255+ null ) ;
256+ }
242257 private static CorrectionExtent GetCorrectionExtent ( AttributeAst cmdletBindingAttributeAst )
243258 {
244259 // 1 for 1 based offset and 1 for the next position.
You can’t perform that action at this time.
0 commit comments