mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-16 19:41:34 +00:00
Merge pull request #19424 from overleaf/jdt-batch-spelling-line-tracker-updates
Line changes spread into array (avoiding max call stack) GitOrigin-RevId: a60520b2aff18603bfe96b92abf305576661223a
This commit is contained in:
parent
806250a30e
commit
cb6deab3a9
1 changed files with 7 additions and 11 deletions
|
@ -113,18 +113,14 @@ export class LineTracker {
|
|||
*/
|
||||
|
||||
const changes = new Array(insertedText.lines).fill(true)
|
||||
try {
|
||||
this._lines.splice(startLine - 1 + lineShift, 1, ...changes)
|
||||
lineShift += changes.length - 1
|
||||
} catch (error) {
|
||||
if (error instanceof RangeError) {
|
||||
throw new OError(error.message).withInfo({
|
||||
changesSize: changes.length,
|
||||
})
|
||||
}
|
||||
const index = startLine - 1 + lineShift
|
||||
|
||||
throw error
|
||||
}
|
||||
this._lines = [
|
||||
...this._lines.slice(0, index),
|
||||
...changes,
|
||||
...this._lines.slice(index + 1),
|
||||
]
|
||||
lineShift += changes.length - 1
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue