| 25 | } |
| 26 | |
| 27 | private getRanges(targets: TypedSelection[]) { |
| 28 | let lines = targets.flatMap((target) => { |
| 29 | const lines = []; |
| 30 | if (this.insertAbove) { |
| 31 | lines.push(target.selection.selection.start.line); |
| 32 | } |
| 33 | if (this.insertBelow) { |
| 34 | lines.push(target.selection.selection.end.line + 1); |
| 35 | } |
| 36 | return lines; |
| 37 | }); |
| 38 | // Remove duplicates |
| 39 | lines = [...new Set(lines)]; |
| 40 | |
| 41 | return lines.map((line) => new Range(line, 0, line, 0)); |
| 42 | } |
| 43 | |
| 44 | private getEdits(ranges: Range[]) { |
| 45 | return ranges.map((range) => ({ |