diff --git a/src/vs/workbench/browser/labels.ts b/src/vs/workbench/browser/labels.ts index 99c24e24cb52b6d12e6881b5d766ecd1ae71a417..8742e98d27e908d51dfb894b65877f5ffa5eea1b 100644 --- a/src/vs/workbench/browser/labels.ts +++ b/src/vs/workbench/browser/labels.ts @@ -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); } diff --git a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts index a7ee659d338b5a33badfbc401875817c547a31bf..30e2150437bb7cca6150fe2a94a74b95b1029a2f 100644 --- a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts +++ b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts @@ -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().explorer.decorations + fileDecorations: this.configurationService.getValue().explorer.decorations, + descriptionVerbosity: Verbosity.MEDIUM }); } diff --git a/src/vs/workbench/contrib/files/common/editors/fileEditorInput.ts b/src/vs/workbench/contrib/files/common/editors/fileEditorInput.ts index d146effdb257d96debf01dbf214980f8d4e7dce1..c9d15e680c14beb2a1fbfd8d9c73a5d2f55670d5 100644 --- a/src/vs/workbench/contrib/files/common/editors/fileEditorInput.ts +++ b/src/vs/workbench/contrib/files/common/editors/fileEditorInput.ts @@ -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)); }