extensions/typescript-language-features/src/languageFeatures/tagClosing.ts/requireActiveDocument
function requireActiveDocument(
	selector: vscode.DocumentSelector
) {
	return new Condition(
		() => {
			const editor = vscode.window.activeTextEditor;
			return !!(editor && vscode.languages.match(selector, editor.document));
		},
		handler => {
			return vscode.Disposable.from(
				vscode.window.onDidChangeActiveTextEditor(handler),
				vscode.workspace.onDidOpenTextDocument(handler));
		});
}