diff --git a/extensions/typescript/src/utils/managedFileContext.ts b/extensions/typescript/src/utils/managedFileContext.ts index a4aeca7dfae69c00c0c67d28267ec0983e523fac..c8755aa4db780e0b41fb6501181148839eae68e9 100644 --- a/extensions/typescript/src/utils/managedFileContext.ts +++ b/extensions/typescript/src/utils/managedFileContext.ts @@ -31,9 +31,11 @@ export default class ManagedFileContextManager { this.onDidChangeActiveTextEditorSub.dispose(); } - private onDidChangeActiveTextEditor(editor: vscode.TextEditor): any { - const isManagedFile = isSupportedLanguageMode(editor.document) && this.normalizePath(editor.document.uri) !== null; - this.updateContext(isManagedFile); + private onDidChangeActiveTextEditor(editor?: vscode.TextEditor): any { + if (editor) { + const isManagedFile = isSupportedLanguageMode(editor.document) && this.normalizePath(editor.document.uri) !== null; + this.updateContext(isManagedFile); + } } private updateContext(newValue: boolean) {