This commit is contained in:
Alex Dima 2018-08-27 15:36:16 +02:00
parent da40432b85
commit c3ff42d57a

View file

@ -1323,7 +1323,12 @@ export class TextModel extends Disposable implements model.ITextModel {
for (let i = 0, len = contentChanges.length; i < len; i++) {
const change = contentChanges[i];
const [eolCount, firstLineLength] = TextModel._eolCount(change.text);
this._tokens.applyEdits(change.range, eolCount, firstLineLength);
try {
this._tokens.applyEdits(change.range, eolCount, firstLineLength);
} catch (err) {
// emergency recovery => reset tokens
this._tokens = new ModelLinesTokens(this._tokens.languageIdentifier, this._tokens.tokenizationSupport);
}
this._onDidChangeDecorations.fire();
this._decorationsTree.acceptReplace(change.rangeOffset, change.rangeLength, change.text.length, change.forceMoveMarkers);