Skip to content

Commit

Permalink
Update TextEdits.rsc
Browse files Browse the repository at this point in the history
Added a convenience function to avoid having to repeat the file location again.
  • Loading branch information
jurgenvinju authored Nov 1, 2024
1 parent b74692d commit a10f8cd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/org/rascalmpl/library/analysis/diff/edits/TextEdits.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ data DocumentEdit
| changed(loc file, list[TextEdit] edits)
;

@synopsis{Shorthand for file changes.}
DocumentEdit changed(list[TextEdit] edits:[replace(loc l, str _), *_])
= changed(l.top, edits);

@synopsis{String rewriting operations}
@description{
The core operation is to replace a substring with another.
Expand All @@ -55,4 +59,4 @@ TextEdit insertBefore(loc range, str insertion, str 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>");


0 comments on commit a10f8cd

Please sign in to comment.