Skip to content

Commit 74f67c7

Browse files
author
Kapil Borle
committed
Remove whatif/params only if in param block
1 parent 1e54182 commit 74f67c7

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

rules/UseSupportsShouldProcess.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,18 @@ private List<CorrectionExtent> GetCorrections(
151151
// TODO Do not incrementally correct the text as it may lead to a situation in which a following
152152
// edits might try to modify edits that have already taken place.
153153
// A better approach is to gather all the edits and give them to the text edit class to handle.
154-
if (whatIfIndex != -1)
155-
{
156-
correctionExtents.Add(GetCorrectionExtent(whatIfIndex, parameterAsts));
157-
}
158-
159-
if (confirmIndex != -1)
160-
{
161-
correctionExtents.Add(GetCorrectionExtent(confirmIndex, parameterAsts));
162-
}
163154

164155
if (paramBlockAst != null)
165156
{
157+
if (whatIfIndex != -1)
158+
{
159+
correctionExtents.Add(GetCorrectionExtent(whatIfIndex, parameterAsts));
160+
}
161+
162+
if (confirmIndex != -1)
163+
{
164+
correctionExtents.Add(GetCorrectionExtent(confirmIndex, parameterAsts));
165+
}
166166
AttributeAst attributeAst;
167167
// check if it has cmdletbinding attribute
168168
if (TryGetCmdletBindingAttribute(paramBlockAst, out attributeAst))

0 commit comments

Comments
 (0)