Merge from vscode a5cf1da01d5db3d2557132be8d30f89c38019f6c (#8525)

* Merge from vscode a5cf1da01d5db3d2557132be8d30f89c38019f6c

* remove files we don't want

* fix hygiene

* update distro

* update distro

* fix hygiene

* fix strict nulls

* distro

* distro

* fix tests

* fix tests

* add another edit

* fix viewlet icon

* fix azure dialog

* fix some padding

* fix more padding issues
This commit is contained in:
Anthony Dresser
2019-12-04 19:28:22 -08:00
committed by GitHub
parent a8818ab0df
commit f5ce7fb2a5
1507 changed files with 42813 additions and 27370 deletions

View File

@@ -13,7 +13,7 @@ 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';
import { IModelService } from 'vs/editor/common/services/modelService';
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { IUntitledTextEditorService } from 'vs/workbench/services/untitled/common/untitledTextEditorService';
import { IDecorationsService, IResourceDecorationChangeEvent } from 'vs/workbench/services/decorations/browser/decorations';
import { Schemas } from 'vs/base/common/network';
import { FileKind, FILES_ASSOCIATIONS_CONFIG, IFileService } from 'vs/platform/files/common/files';
@@ -22,13 +22,13 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import { Event, Emitter } from 'vs/base/common/event';
import { ILabelService } from 'vs/platform/label/common/label';
import { getIconClasses, detectModeId } from 'vs/editor/common/services/getIconClasses';
import { Disposable, dispose, IDisposable } from 'vs/base/common/lifecycle';
import { Disposable, dispose, IDisposable, DisposableStore } from 'vs/base/common/lifecycle';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { withNullAsUndefined } from 'vs/base/common/types';
export interface IResourceLabelProps {
resource?: URI;
name?: string;
name?: string | string[];
description?: string;
}
@@ -41,6 +41,7 @@ export interface IResourceLabelOptions extends IIconLabelValueOptions {
export interface IFileLabelOptions extends IResourceLabelOptions {
hideLabel?: boolean;
hidePath?: boolean;
readonly parentCount?: number;
}
export interface IResourceLabel extends IDisposable {
@@ -164,7 +165,7 @@ export class ResourceLabels extends Disposable {
const label: IResourceLabel = {
element: widget.element,
onDidRender: widget.onDidRender,
setLabel: (label?: string, description?: string, options?: IIconLabelValueOptions) => widget.setLabel(label, description, options),
setLabel: (label: string, description?: string, options?: IIconLabelValueOptions) => widget.setLabel(label, description, options),
setResource: (label: IResourceLabelProps, options?: IResourceLabelOptions) => widget.setResource(label, options),
setEditor: (editor: IEditorInput, options?: IResourceLabelOptions) => widget.setEditor(editor, options),
setFile: (resource: URI, options?: IFileLabelOptions) => widget.setFile(resource, options),
@@ -241,6 +242,8 @@ class ResourceLabelWidget extends IconLabel {
private _onDidRender = this._register(new Emitter<void>());
readonly onDidRender: Event<void> = this._onDidRender.event;
private readonly renderDisposables = this._register(new DisposableStore());
private label?: IResourceLabelProps;
private options?: IResourceLabelOptions;
private computedIconClasses?: string[];
@@ -257,7 +260,7 @@ class ResourceLabelWidget extends IconLabel {
@IModelService private readonly modelService: IModelService,
@IDecorationsService private readonly decorationsService: IDecorationsService,
@ILabelService private readonly labelService: ILabelService,
@IUntitledEditorService private readonly untitledEditorService: IUntitledEditorService,
@IUntitledTextEditorService private readonly untitledTextEditorService: IUntitledTextEditorService,
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService
) {
super(container, options);
@@ -365,7 +368,7 @@ class ResourceLabelWidget extends IconLabel {
setEditor(editor: IEditorInput, options?: IResourceLabelOptions): void {
this.setResource({
resource: toResource(editor, { supportSideBySide: SideBySideEditor.MASTER }),
name: withNullAsUndefined(editor.getName()),
name: editor.getName(),
description: editor.getDescription(options ? options.descriptionVerbosity : undefined)
}, options);
}
@@ -387,7 +390,7 @@ class ResourceLabelWidget extends IconLabel {
}
let description: string | undefined;
const hidePath = (options && options.hidePath) || (resource.scheme === Schemas.untitled && !this.untitledEditorService.hasAssociatedFilePath(resource));
const hidePath = (options && options.hidePath) || (resource.scheme === Schemas.untitled && !this.untitledTextEditorService.hasAssociatedFilePath(resource));
if (!hidePath) {
description = this.labelService.getUriLabel(resources.dirname(resource), { relative: true });
}
@@ -402,7 +405,7 @@ class ResourceLabelWidget extends IconLabel {
this.computedIconClasses = undefined;
this.computedPathLabel = undefined;
this.setLabel();
this.setLabel('');
}
private render(clearIconCache: boolean): void {
@@ -434,11 +437,15 @@ class ResourceLabelWidget extends IconLabel {
return;
}
this.renderDisposables.clear();
const iconLabelOptions: IIconLabelValueOptions & { extraClasses: string[] } = {
title: '',
italic: this.options && this.options.italic,
matches: this.options && this.options.matches,
extraClasses: []
extraClasses: [],
separator: this.options?.separator,
domId: this.options?.domId
};
const resource = this.label.resource;
@@ -472,6 +479,9 @@ class ResourceLabelWidget extends IconLabel {
);
if (deco) {
this.renderDisposables.add(deco);
if (deco.tooltip) {
iconLabelOptions.title = `${iconLabelOptions.title}${deco.tooltip}`;
}
@@ -486,7 +496,7 @@ class ResourceLabelWidget extends IconLabel {
}
}
this.setLabel(label, this.label.description, iconLabelOptions);
this.setLabel(label || '', this.label.description, iconLabelOptions);
this._onDidRender.fire();
}