Skip to content

Commit

Permalink
Add indent to the ignore comment
Browse files Browse the repository at this point in the history
  • Loading branch information
PiotrRogulski committed Dec 2, 2023
1 parent bb81611 commit ad808be
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/custom_lint_builder/lib/src/ignore.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,13 @@ class IgnoreCode extends DartFix {

final startLineOffset = resolver.lineInfo.getOffsetOfLine(offsetLine);

final indentLength = resolver.source.contents.data
.substring(startLineOffset)
.indexOf(RegExp(r'\S'));

builder.addSimpleInsertion(
startLineOffset,
'// ignore: ${analysisError.errorCode.name}\n',
'${' ' * indentLength}// ignore: ${analysisError.errorCode.name}\n',
);
}
});
Expand Down

0 comments on commit ad808be

Please sign in to comment.