This commit is contained in:
isidor 2019-07-03 17:11:02 +02:00
parent b736c9aa5d
commit c0a9bc3988
3 changed files with 9 additions and 7 deletions

View file

@ -8,7 +8,7 @@ import * as resources from 'vs/base/common/resources';
import { IconLabel, IIconLabelValueOptions, IIconLabelCreationOptions } from 'vs/base/browser/ui/iconLabel/iconLabel';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { IModeService } from 'vs/editor/common/services/modeService';
import { toResource, IEditorInput, SideBySideEditor } from 'vs/workbench/common/editor';
import { toResource, IEditorInput, SideBySideEditor, Verbosity } from 'vs/workbench/common/editor';
import { PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
@ -35,6 +35,7 @@ export interface IResourceLabelProps {
export interface IResourceLabelOptions extends IIconLabelValueOptions {
fileKind?: FileKind;
fileDecorations?: { colors: boolean, badges: boolean, data?: IDecorationData };
descriptionVerbosity?: Verbosity;
}
export interface IFileLabelOptions extends IResourceLabelOptions {
@ -316,6 +317,9 @@ class ResourceLabelWidget extends IconLabel {
}
notifyFormattersChange(): void {
if (this.label && this.label.resource) {
this.setFile(this.label.resource, this.options);
}
this.render(false);
}
@ -362,7 +366,7 @@ class ResourceLabelWidget extends IconLabel {
this.setResource({
resource: toResource(editor, { supportSideBySide: SideBySideEditor.MASTER }),
name: withNullAsUndefined(editor.getName()),
description: withNullAsUndefined(editor.getDescription())
description: withNullAsUndefined(editor.getDescription(options ? options.descriptionVerbosity : undefined))
}, options);
}

View file

@ -12,7 +12,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { IEditorGroupsService, IEditorGroup, GroupChangeKind, GroupsOrder } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IEditorInput } from 'vs/workbench/common/editor';
import { IEditorInput, Verbosity } from 'vs/workbench/common/editor';
import { SaveAllAction, SaveAllInGroupAction, CloseGroupAction } from 'vs/workbench/contrib/files/browser/fileActions';
import { OpenEditorsFocusedContext, ExplorerFocusedContext, IFilesConfiguration, OpenEditor } from 'vs/workbench/contrib/files/common/files';
import { ITextFileService, AutoSaveMode } from 'vs/workbench/services/textfile/common/textfiles';
@ -570,7 +570,8 @@ class OpenEditorRenderer implements IListRenderer<OpenEditor, IOpenEditorTemplat
templateData.root.setEditor(editor.editor, {
italic: editor.isPreview(),
extraClasses: ['open-editor'],
fileDecorations: this.configurationService.getValue<IFilesConfiguration>().explorer.decorations
fileDecorations: this.configurationService.getValue<IFilesConfiguration>().explorer.decorations,
descriptionVerbosity: Verbosity.MEDIUM
});
}

View file

@ -150,17 +150,14 @@ export class FileEditorInput extends EditorInput implements IFileEditorInput {
return this.decorateLabel(this.name);
}
@memoize
private get shortDescription(): string {
return basename(this.labelService.getUriLabel(dirname(this.resource)));
}
@memoize
private get mediumDescription(): string {
return this.labelService.getUriLabel(dirname(this.resource), { relative: true });
}
@memoize
private get longDescription(): string {
return this.labelService.getUriLabel(dirname(this.resource));
}