(targets: TypedSelection[], at: string)
| 92 | } |
| 93 | |
| 94 | function getLineNumber(targets: TypedSelection[], at: string) { |
| 95 | let startLine = Number.MAX_SAFE_INTEGER; |
| 96 | let endLine = 0; |
| 97 | targets.forEach((t: TypedSelection) => { |
| 98 | startLine = Math.min(startLine, t.selection.selection.start.line); |
| 99 | endLine = Math.max(endLine, t.selection.selection.end.line); |
| 100 | }); |
| 101 | |
| 102 | if (at === "top") { |
| 103 | return startLine; |
| 104 | } |
| 105 | if (at === "bottom") { |
| 106 | return endLine; |
| 107 | } |
| 108 | return Math.floor((startLine + endLine) / 2); |
| 109 | } |