Skip to content

Commit

Permalink
added line/column info to insertBefore and insertAfter
Browse files Browse the repository at this point in the history
  • Loading branch information
jurgenvinju committed Nov 5, 2024
1 parent d954af7 commit 6fa3b43
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/org/rascalmpl/library/analysis/diff/edits/TextEdits.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,13 @@ TextEdit delete(loc range)

@synopsis{Inserting before a given range.}
TextEdit insertBefore(loc range, str insertion, str separator=" ")
= replace(range.top(range.offset, 0), "<insertion><separator>");
= range.begin?
? replace(range.top(range.offset, 0, range.begin, range.begin), "<insertion><separator>")
: replace(range.top(range.offset, 0), "<insertion><separator>");

@synopsis{Inserting after a given range.}
TextEdit insertAfter(loc range, str insertion, str separator=" ")
= replace(range.top(range.offset + range.length, 0), "<separator><insertion>");
= range.begin?
? replace(range.top(range.offset + range.length, 0, range.end, range.end), "<separator><insertion>");
: replace(range.top(range.offset + range.length, 0), "<separator><insertion>");

0 comments on commit 6fa3b43

Please sign in to comment.