()
| 164 | } |
| 165 | |
| 166 | dedupdeAndSort() { |
| 167 | this.lines.sort((a, b) => { |
| 168 | return a.yCoord - b.yCoord |
| 169 | }) |
| 170 | |
| 171 | for (const [x, y, nodeCursor] of this.supplimentaryCursors) { |
| 172 | if (y in this.linesIndex) { |
| 173 | this.linesIndex[y].entries.push({ |
| 174 | isCursor: true, |
| 175 | nodeCursors: [[nodeCursor, CursorType.Primary]], |
| 176 | xCoord: x, |
| 177 | }) |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | for (const line of this.lines) { |
| 182 | const entries = line.entries |
| 183 | entries.sort((a, b) => { |
| 184 | return a.xCoord - b.xCoord |
| 185 | }) |
| 186 | const newEntries = entries.slice(0, 1) |
| 187 | let prev = newEntries[0] |
| 188 | for (const entry of entries.slice(1)) { |
| 189 | if (entry.isCursor && prev.isCursor && entry.xCoord - prev.xCoord < 1) { |
| 190 | prev.nodeCursors.push(...entry.nodeCursors) |
| 191 | } else { |
| 192 | newEntries.push(entry) |
| 193 | prev = entry |
| 194 | } |
| 195 | } |
| 196 | line.entries = newEntries |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | getLineIndexForYCoord(yCoord: number): number { |
| 201 | let lineIndex = 0 |
no outgoing calls
no test coverage detected