This commit is contained in:
Benjamin Pasero
2019-07-09 07:34:24 +02:00
parent c0989dff49
commit 2ea7d60b25
7 changed files with 37 additions and 37 deletions
@@ -38,7 +38,7 @@ export class EditorControl extends Disposable {
private _activeControl: BaseEditor | null;
private controls: BaseEditor[] = [];
private readonly activeControlDisposeables = this._register(new DisposableStore());
private readonly activeControlDisposables = this._register(new DisposableStore());
private dimension: Dimension;
private editorOperation: LongRunningOperation;
@@ -139,12 +139,12 @@ export class EditorControl extends Disposable {
this._activeControl = control;
// Clear out previous active control listeners
this.activeControlDisposeables.clear();
this.activeControlDisposables.clear();
// Listen to control changes
if (control) {
this.activeControlDisposeables.add(control.onDidSizeConstraintsChange(e => this._onDidSizeConstraintsChange.fire(e)));
this.activeControlDisposeables.add(control.onDidFocus(() => this._onDidFocus.fire()));
this.activeControlDisposables.add(control.onDidSizeConstraintsChange(e => this._onDidSizeConstraintsChange.fire(e)));
this.activeControlDisposables.add(control.onDidFocus(() => this._onDidFocus.fire()));
}
// Indicate that size constraints could have changed due to new editor
@@ -900,7 +900,7 @@ export class ChangeModeAction extends Action {
return {
label: lang,
iconClasses: getIconClasses(this.modelService, this.modeService, this.getResource(lang)),
iconClasses: getIconClasses(this.modelService, this.modeService, this.getFakeResource(lang)),
description
};
});
@@ -999,7 +999,7 @@ export class ChangeModeAction extends Action {
return {
id,
label: lang,
iconClasses: getIconClasses(this.modelService, this.modeService, this.getResource(lang)),
iconClasses: getIconClasses(this.modelService, this.modeService, this.getFakeResource(lang)),
description: (id === currentAssociation) ? nls.localize('currentAssociation', "Current Association") : undefined
};
});
@@ -1031,9 +1031,9 @@ export class ChangeModeAction extends Action {
}, 50 /* quick open is sensitive to being opened so soon after another */);
}
private getResource(lang: string): URI | undefined {
// construct a fake resource to be able to show nice icons if any
private getFakeResource(lang: string): URI | undefined {
let fakeResource: URI | undefined;
const extensions = this.modeService.getExtensions(lang);
if (extensions && extensions.length) {
fakeResource = URI.file(extensions[0]);
@@ -1043,6 +1043,7 @@ export class ChangeModeAction extends Action {
fakeResource = URI.file(filenames[0]);
}
}
return fakeResource;
}
}
@@ -61,7 +61,7 @@ export class TabsTitleControl extends TitleControl {
private tabResourceLabels: ResourceLabels;
private tabLabels: IEditorInputLabel[] = [];
private tabDisposeables: IDisposable[] = [];
private tabDisposables: IDisposable[] = [];
private dimension: Dimension;
private readonly layoutScheduled = this._register(new MutableDisposable());
@@ -301,7 +301,7 @@ export class TabsTitleControl extends TitleControl {
(this.tabsContainer.lastChild as HTMLElement).remove();
// Remove associated tab label and widget
this.tabDisposeables.pop()!.dispose();
this.tabDisposables.pop()!.dispose();
}
// A removal of a label requires to recompute all labels
@@ -315,7 +315,7 @@ export class TabsTitleControl extends TitleControl {
else {
clearNode(this.tabsContainer);
this.tabDisposeables = dispose(this.tabDisposeables);
this.tabDisposables = dispose(this.tabDisposables);
this.tabResourceLabels.clear();
this.tabLabels = [];
@@ -454,7 +454,7 @@ export class TabsTitleControl extends TitleControl {
// Eventing
const eventsDisposable = this.registerTabListeners(tabContainer, index);
this.tabDisposeables.push(combinedDisposable(eventsDisposable, tabActionBar, tabActionRunner, editorLabel));
this.tabDisposables.push(combinedDisposable(eventsDisposable, tabActionBar, tabActionRunner, editorLabel));
return tabContainer;
}
@@ -1149,7 +1149,7 @@ export class TabsTitleControl extends TitleControl {
dispose(): void {
super.dispose();
this.tabDisposeables = dispose(this.tabDisposeables);
this.tabDisposables = dispose(this.tabDisposables);
}
}
@@ -135,7 +135,7 @@ export class NotificationsToasts extends Themable {
// Make Visible
addClass(this.notificationsToastsContainer, 'visible');
const itemDisposeables = new DisposableStore();
const itemDisposables = new DisposableStore();
// Container
const notificationToastContainer = document.createElement('div');
@@ -158,12 +158,12 @@ export class NotificationsToasts extends Themable {
ariaLabel: localize('notificationsToast', "Notification Toast"),
verticalScrollMode: ScrollbarVisibility.Hidden
});
itemDisposeables.add(notificationList);
itemDisposables.add(notificationList);
const toast: INotificationToast = { item, list: notificationList, container: notificationToastContainer, toast: notificationToast, toDispose: itemDisposeables };
const toast: INotificationToast = { item, list: notificationList, container: notificationToastContainer, toast: notificationToast, toDispose: itemDisposables };
this.mapNotificationToToast.set(item, toast);
itemDisposeables.add(toDisposable(() => {
itemDisposables.add(toDisposable(() => {
if (this.isVisible(toast)) {
this.notificationsToastsContainer.removeChild(toast.container);
}
@@ -184,12 +184,12 @@ export class NotificationsToasts extends Themable {
this.layoutContainer(maxDimensions.height);
// Update when item height changes due to expansion
itemDisposeables.add(item.onDidExpansionChange(() => {
itemDisposables.add(item.onDidExpansionChange(() => {
notificationList.updateNotificationsList(0, 1, [item]);
}));
// Update when item height potentially changes due to label changes
itemDisposeables.add(item.onDidLabelChange(e => {
itemDisposables.add(item.onDidLabelChange(e => {
if (!item.expanded) {
return; // dynamic height only applies to expanded notifications
}
@@ -205,7 +205,7 @@ export class NotificationsToasts extends Themable {
});
// Automatically purge non-sticky notifications
this.purgeNotification(item, notificationToastContainer, notificationList, itemDisposeables);
this.purgeNotification(item, notificationToastContainer, notificationList, itemDisposables);
// Theming
this.updateStyles();
@@ -215,7 +215,7 @@ export class NotificationsToasts extends Themable {
// Animate in
addClass(notificationToast, 'notification-fade-in');
itemDisposeables.add(addDisposableListener(notificationToast, 'transitionend', () => {
itemDisposables.add(addDisposableListener(notificationToast, 'transitionend', () => {
removeClass(notificationToast, 'notification-fade-in');
addClass(notificationToast, 'notification-fade-in-done');
}));
@@ -288,7 +288,7 @@ export class NotificationTemplateRenderer extends Disposable {
private static readonly SEVERITIES: Array<'info' | 'warning' | 'error'> = ['info', 'warning', 'error'];
private readonly inputDisposeables = this._register(new DisposableStore());
private readonly inputDisposables = this._register(new DisposableStore());
constructor(
private template: INotificationTemplateData,
@@ -308,7 +308,7 @@ export class NotificationTemplateRenderer extends Disposable {
}
setInput(notification: INotificationViewItem): void {
this.inputDisposeables.clear();
this.inputDisposables.clear();
this.render(notification);
}
@@ -317,7 +317,7 @@ export class NotificationTemplateRenderer extends Disposable {
// Container
toggleClass(this.template.container, 'expanded', notification.expanded);
this.inputDisposeables.add(addDisposableListener(this.template.container, EventType.MOUSE_UP, e => {
this.inputDisposables.add(addDisposableListener(this.template.container, EventType.MOUSE_UP, e => {
if (e.button === 1 /* Middle Button */) {
EventHelper.stop(e);
@@ -344,7 +344,7 @@ export class NotificationTemplateRenderer extends Disposable {
this.renderProgress(notification);
// Label Change Events
this.inputDisposeables.add(notification.onDidLabelChange(event => {
this.inputDisposables.add(notification.onDidLabelChange(event => {
switch (event.kind) {
case NotificationViewItemLabelKind.SEVERITY:
this.renderSeverity(notification);
@@ -370,7 +370,7 @@ export class NotificationTemplateRenderer extends Disposable {
clearNode(this.template.message);
this.template.message.appendChild(NotificationMessageRenderer.render(notification.message, {
callback: link => this.openerService.open(URI.parse(link)),
toDispose: this.inputDisposeables
toDispose: this.inputDisposables
}));
const messageOverflows = notification.canCollapse && !notification.expanded && this.template.message.scrollWidth > this.template.message.clientWidth;
@@ -395,7 +395,7 @@ export class NotificationTemplateRenderer extends Disposable {
if (isNonEmptyArray(notification.actions.secondary)) {
const configureNotificationAction = this.instantiationService.createInstance(ConfigureNotificationAction, ConfigureNotificationAction.ID, ConfigureNotificationAction.LABEL, notification.actions.secondary);
actions.push(configureNotificationAction);
this.inputDisposeables.add(configureNotificationAction);
this.inputDisposables.add(configureNotificationAction);
}
// Expand / Collapse
@@ -441,7 +441,7 @@ export class NotificationTemplateRenderer extends Disposable {
const action = notification.actions.primary![index];
button.label = action.label;
this.inputDisposeables.add(button.onDidClick(e => {
this.inputDisposables.add(button.onDidClick(e => {
EventHelper.stop(e, true);
// Run action
@@ -453,10 +453,10 @@ export class NotificationTemplateRenderer extends Disposable {
}
}));
this.inputDisposeables.add(attachButtonStyler(button, this.themeService));
this.inputDisposables.add(attachButtonStyler(button, this.themeService));
});
this.inputDisposeables.add(buttonGroup);
this.inputDisposables.add(buttonGroup);
}
}
@@ -210,7 +210,6 @@ class CodeRendererMain extends Disposable {
fileService.registerProvider(Schemas.vscodeRemote, remoteFileSystemProvider);
}
const payload = await this.resolveWorkspaceInitializationPayload();
const services = await Promise.all([
@@ -118,29 +118,29 @@ export class EditorService extends Disposable implements EditorServiceImpl {
}
private registerGroupListeners(group: IEditorGroupView): void {
const groupDisposeables = new DisposableStore();
const groupDisposables = new DisposableStore();
groupDisposeables.add(group.onDidGroupChange(e => {
groupDisposables.add(group.onDidGroupChange(e => {
if (e.kind === GroupChangeKind.EDITOR_ACTIVE) {
this.handleActiveEditorChange(group);
this._onDidVisibleEditorsChange.fire();
}
}));
groupDisposeables.add(group.onDidCloseEditor(event => {
groupDisposables.add(group.onDidCloseEditor(event => {
this._onDidCloseEditor.fire(event);
}));
groupDisposeables.add(group.onWillOpenEditor(event => {
groupDisposables.add(group.onWillOpenEditor(event => {
this.onGroupWillOpenEditor(group, event);
}));
groupDisposeables.add(group.onDidOpenEditorFail(editor => {
groupDisposables.add(group.onDidOpenEditorFail(editor => {
this._onDidOpenEditorFail.fire({ editor, groupId: group.id });
}));
Event.once(group.onWillDispose)(() => {
dispose(groupDisposeables);
dispose(groupDisposables);
});
}