Skip to content

Commit fb829f8

Browse files
authored
Merge pull request #2547 from comintern/next
Fixes #2206
2 parents c49be4c + c54c8b5 commit fb829f8

File tree

9 files changed

+1681
-1662
lines changed

9 files changed

+1681
-1662
lines changed

RetailCoder.VBE/Inspections/QuickFixes/IgnoreOnceQuickFix.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ namespace Rubberduck.Inspections.QuickFixes
1010
public class IgnoreOnceQuickFix : QuickFixBase
1111
{
1212
private readonly string _annotationText;
13-
private readonly string _inspectionName;
1413

1514
public IgnoreOnceQuickFix(ParserRuleContext context, QualifiedSelection selection, string inspectionName)
1615
: base(context, selection, InspectionsUI.IgnoreOnce)
1716
{
18-
_inspectionName = inspectionName;
1917
_annotationText = "'" + Annotations.AnnotationMarker +
2018
Annotations.IgnoreInspection + ' ' + inspectionName;
2119
}
@@ -39,7 +37,11 @@ public override void Fix()
3937
int commentStart;
4038
if (codeLine.HasComment(out commentStart) && codeLine.Substring(commentStart).StartsWith(ignoreAnnotation))
4139
{
42-
annotationText = codeLine + ", " + _inspectionName;
40+
var indentation = codeLine.Length - codeLine.TrimStart().Length;
41+
annotationText = string.Format("{0}{1},{2}",
42+
new string(' ', indentation),
43+
_annotationText,
44+
codeLine.Substring(indentation + ignoreAnnotation.Length));
4345
module.ReplaceLine(insertLine - 1, annotationText);
4446
}
4547
else

0 commit comments

Comments
 (0)