addLinesBefore method

void addLinesBefore(
  1. AFCommandContext context,
  2. RegExp match,
  3. List<String> toInsert
)

Adds a set of linies before the first line containing match.

Implementation

void addLinesBefore(AFCommandContext context, RegExp match, List<String> toInsert) {
  modified = true;
  final idx = firstLineContaining(context, match);
  if(idx < 0) {
    _throwMissingMatchRegex(match);
  } else {
    lines.insertAll(idx-1, toInsert);
  }
}