提交 2d0492fd 编写于 作者: B Benjamin Pasero

labels - lift some event handling up

上级 51582b9d
......@@ -100,7 +100,17 @@ export class ResourceLabels extends Disposable {
this._register(this.extensionService.onDidRegisterExtensions(() => this._widgets.forEach(widget => widget.notifyExtensionsRegistered())));
// notify when model mode changes
this._register(this.modelService.onModelModeChanged(e => this._widgets.forEach(widget => widget.notifyModelModeChanged(e))));
this._register(this.modelService.onModelModeChanged(e => {
if (!e.model.uri) {
return; // we need the resource to compare
}
if (e.model.uri.scheme === Schemas.file && e.oldModeId === PLAINTEXT_MODE_ID) { // todo@remote does this apply?
return; // ignore transitions in files from no mode to specific mode because this happens each time a model is created
}
this._widgets.forEach(widget => widget.notifyModelModeChanged(e));
}));
// notify when file decoration changes
this._register(this.decorationsService.onDidChangeDecorations(e => this._widgets.forEach(widget => widget.notifyFileDecorationsChanges(e))));
......@@ -245,14 +255,6 @@ class ResourceLabelWidget extends IconLabel {
return; // only update if label exists
}
if (!e.model.uri) {
return; // we need the resource to compare
}
if (e.model.uri.scheme === Schemas.file && e.oldModeId === PLAINTEXT_MODE_ID) { // todo@remote does this apply?
return; // ignore transitions in files from no mode to specific mode because this happens each time a model is created
}
if (e.model.uri.toString() === this.label.resource.toString()) {
if (this.lastKnownConfiguredLangId !== e.model.getLanguageIdentifier().language) {
this.render(true); // update if the language id of the model has changed from our last known state
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册