Make sure we update tag closing registration when the document's language changes

Fixes #67613
This commit is contained in:
Matt Bierner
2019-01-30 18:50:41 -08:00
parent 7a53ca7dec
commit 9a766eaa38

View File

@@ -144,6 +144,7 @@ export class ActiveDocumentDependentRegistration extends Disposable {
super();
this._registration = this._register(new ConditionalRegistration(register));
vscode.window.onDidChangeActiveTextEditor(this.update, this, this._disposables);
vscode.workspace.onDidOpenTextDocument(this.onDidOpenDocument, this, this._disposables);
this.update();
}
@@ -152,6 +153,13 @@ export class ActiveDocumentDependentRegistration extends Disposable {
const enabled = !!(editor && vscode.languages.match(this.selector, editor.document));
this._registration.update(enabled);
}
private onDidOpenDocument(openedDocument: vscode.TextDocument) {
if (vscode.window.activeTextEditor && vscode.window.activeTextEditor.document === openedDocument) {
// The active document's language may have changed
this.update();
}
}
}
export function register(