Description
When editing Dart files, indent-rainbow highlights the leading whitespace of continuation lines after a constructor initializer list as an indentation error (e.g. red background), even though the code is valid and commonly produced by dart format.
This happens because Dart style often aligns the next initializer under the first initializer on the previous line, which can result in a non-multiple-of-indent-size number of leading spaces (alignment-based indentation), not a strict hierarchical indent step.
Environment
- Editor: VS Code / Cursor (please specify)
- Extension: indent-rainbow (please specify exact extension id + version from marketplace)
- OS: Windows 10/11 (please specify)
Steps to reproduce
- Install indent-rainbow with default settings (or typical "error highlight" enabled).
- Create a
.dart file with a constructor that uses an initializer list split across two lines, where the second line is indented to align with the first initializer (as dart format does).
Minimal reproducible example (Dart)
class ComicRepositoryImpl {
ComicRepositoryImpl(
this._comicDao, {
required ReadingHistoryRepository readingHistory,
required SeriesRepository librarySeries,
}) : _readingHistory = readingHistory,
_librarySeries = librarySeries;
final dynamic _comicDao;
final ReadingHistoryRepository _readingHistory;
final SeriesRepository _librarySeries;
}
// placeholder types so the snippet parses
class ReadingHistoryRepository {}
class SeriesRepository {}
Description
When editing Dart files,
indent-rainbowhighlights the leading whitespace of continuation lines after a constructor initializer list as an indentation error (e.g. red background), even though the code is valid and commonly produced bydart format.This happens because Dart style often aligns the next initializer under the first initializer on the previous line, which can result in a non-multiple-of-indent-size number of leading spaces (alignment-based indentation), not a strict hierarchical indent step.
Environment
Steps to reproduce
.dartfile with a constructor that uses an initializer list split across two lines, where the second line is indented to align with the first initializer (asdart formatdoes).Minimal reproducible example (Dart)