diff --git a/src/tsconfig.strictNullChecks.json b/src/tsconfig.strictNullChecks.json index 7f4ddd4fb108cbbad81e11ce5c39114ace8509cb..579b0a9e0d9226b7073eb3755428612a1056e584 100644 --- a/src/tsconfig.strictNullChecks.json +++ b/src/tsconfig.strictNullChecks.json @@ -323,6 +323,7 @@ "./vs/editor/contrib/folding/test/syntaxFold.test.ts", "./vs/editor/contrib/fontZoom/fontZoom.ts", "./vs/editor/contrib/format/format.ts", + "./vs/editor/contrib/format/formattingEdit.ts", "./vs/editor/contrib/goToDefinition/clickLinkGesture.ts", "./vs/editor/contrib/goToDefinition/goToDefinition.ts", "./vs/editor/contrib/gotoError/gotoError.ts", diff --git a/src/vs/editor/contrib/format/formattingEdit.ts b/src/vs/editor/contrib/format/formattingEdit.ts index b83bb89eb036c2c708ff7acda3c79631de7797d8..23bab3f18305b0fb7a2917f0176a42c924536265 100644 --- a/src/vs/editor/contrib/format/formattingEdit.ts +++ b/src/vs/editor/contrib/format/formattingEdit.ts @@ -25,13 +25,18 @@ export class FormattingEdit { } if (typeof newEol === 'number') { - editor.getModel().pushEOL(newEol); + if (editor.hasModel()) { + editor.getModel().pushEOL(newEol); + } } return singleEdits; } private static _isFullModelReplaceEdit(editor: ICodeEditor, edit: ISingleEditOperation): boolean { + if (!editor.hasModel()) { + return false; + } const model = editor.getModel(); const editRange = model.validateRange(edit.range); const fullModelRange = model.getFullModelRange();