Merge from vscode 099a7622e6e90dbcc226e428d4e35a72cb19ecbc (#9646)

* Merge from vscode 099a7622e6e90dbcc226e428d4e35a72cb19ecbc

* fix strict
This commit is contained in:
Anthony Dresser
2020-03-16 23:16:40 -07:00
committed by GitHub
parent 81e1b9a434
commit a53b78c0c8
170 changed files with 2601 additions and 2026 deletions

View File

@@ -24,11 +24,23 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { withNullAsUndefined } from 'vs/base/common/types';
export interface IResourceLabelProps {
resource?: URI;
resource?: URI | { master?: URI, detail?: URI };
name?: string | string[];
description?: string;
}
function toResource(props: IResourceLabelProps | undefined): URI | undefined {
if (!props || !props.resource) {
return undefined;
}
if (URI.isUri(props.resource)) {
return props.resource;
}
return props.resource.master;
}
export interface IResourceLabelOptions extends IIconLabelValueOptions {
fileKind?: FileKind;
fileDecorations?: { colors: boolean, badges: boolean };
@@ -289,11 +301,16 @@ class ResourceLabelWidget extends IconLabel {
}
notifyFileDecorationsChanges(e: IResourceDecorationChangeEvent): void {
if (!this.options || !this.label || !this.label.resource) {
if (!this.options) {
return;
}
if (this.options.fileDecorations && e.affectsResource(this.label.resource)) {
const resource = toResource(this.label);
if (!resource) {
return;
}
if (this.options.fileDecorations && e.affectsResource(resource)) {
this.render(false);
}
}
@@ -311,13 +328,13 @@ class ResourceLabelWidget extends IconLabel {
}
notifyFormattersChange(scheme: string): void {
if (this.label?.resource?.scheme === scheme) {
if (toResource(this.label)?.scheme === scheme) {
this.render(false);
}
}
notifyUntitledLabelChange(resource: URI): void {
if (isEqual(resource, this.label?.resource)) {
if (isEqual(resource, toResource(this.label))) {
this.render(false);
}
}
@@ -347,7 +364,10 @@ class ResourceLabelWidget extends IconLabel {
}
setResource(label: IResourceLabelProps, options: IResourceLabelOptions = Object.create(null)): void {
/*if (label.resource?.scheme === Schemas.untitled) { {{SQL CARBON EDIT}} we don't want to special case untitled files
/*const resource = toResource(this.label); {{SQL CARBON EDIT}} we don't want to special case untitled files
const isMasterDetail = this.label?.resource && !URI.isUri(this.label.resource);
if (!isMasterDetail && resource?.scheme === Schemas.untitled) {
// Untitled labels are very dynamic because they may change
// whenever the content changes (unless a path is associated).
// As such we always ask the actual editor for it's name and
@@ -355,7 +375,11 @@ class ResourceLabelWidget extends IconLabel {
// provided. If they are not provided from the label we got
// we assume that the client does not want to display them
// and as such do not override.
const untitledModel = this.textFileService.untitled.get(label.resource);
//
// We do not touch the label if it represents a master-detail
// because in that case we expect it to carry a proper label
// and description.
const untitledModel = this.textFileService.untitled.get(resource);
if (untitledModel && !untitledModel.hasAssociatedFilePath) {
if (typeof label.name === 'string') {
label.name = untitledModel.name;
@@ -415,7 +439,7 @@ class ResourceLabelWidget extends IconLabel {
}
private hasPathLabelChanged(newLabel: IResourceLabelProps, newOptions?: IResourceLabelOptions): boolean {
const newResource = newLabel ? newLabel.resource : undefined;
const newResource = toResource(newLabel);
return !!newResource && this.computedPathLabel !== this.labelService.getUriLabel(newResource);
}
@@ -444,7 +468,8 @@ class ResourceLabelWidget extends IconLabel {
}
if (this.label) {
const detectedModeId = this.label.resource ? withNullAsUndefined(detectModeId(this.modelService, this.modeService, this.label.resource)) : undefined;
const resource = toResource(this.label);
const detectedModeId = resource ? withNullAsUndefined(detectModeId(this.modelService, this.modeService, resource)) : undefined;
if (this.lastKnownDetectedModeId !== detectedModeId) {
clearIconCache = true;
this.lastKnownDetectedModeId = detectedModeId;
@@ -463,14 +488,15 @@ class ResourceLabelWidget extends IconLabel {
const iconLabelOptions: IIconLabelValueOptions & { extraClasses: string[] } = {
title: '',
italic: this.options && this.options.italic,
matches: this.options && this.options.matches,
italic: this.options?.italic,
strikethrough: this.options?.strikethrough,
matches: this.options?.matches,
extraClasses: [],
separator: this.options?.separator,
domId: this.options?.domId
};
const resource = this.label.resource;
const resource = toResource(this.label);
const label = this.label.name;
if (this.options && typeof this.options.title === 'string') {

View File

@@ -169,7 +169,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
// Instantiate composite from registry otherwise
const compositeDescriptor = this.registry.getComposite(id);
if (compositeDescriptor) {
const compositeProgressIndicator = this.instantiationService.createInstance(CompositeProgressIndicator, assertIsDefined(this.progressBar), compositeDescriptor.id, !!isActive, undefined);
const compositeProgressIndicator = this.instantiationService.createInstance(CompositeProgressIndicator, assertIsDefined(this.progressBar), compositeDescriptor.id, !!isActive);
const compositeInstantiationService = this.instantiationService.createChild(new ServiceCollection(
[IEditorProgressService, compositeProgressIndicator] // provide the editor progress service for any editors instantiated within the composite
));

View File

@@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
import { localize } from 'vs/nls';
import { IQuickPickSeparator, quickPickItemScorerAccessor, IQuickPickItemWithResource } from 'vs/platform/quickinput/common/quickInput';
import { PickerQuickAccessProvider, IPickerQuickAccessItem, TriggerAction } from 'vs/platform/quickinput/common/quickAccess';
import { IQuickPickSeparator, quickPickItemScorerAccessor, IQuickPickItemWithResource, IQuickPick } from 'vs/platform/quickinput/common/quickInput';
import { PickerQuickAccessProvider, IPickerQuickAccessItem, TriggerAction } from 'vs/platform/quickinput/browser/pickerQuickAccess';
import { IEditorGroupsService, GroupsOrder } from 'vs/workbench/services/editor/common/editorGroupsService';
import { EditorsOrder, IEditorIdentifier, toResource, SideBySideEditor } from 'vs/workbench/common/editor';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
@@ -28,6 +28,12 @@ export abstract class BaseEditorQuickAccessProvider extends PickerQuickAccessPro
super(prefix);
}
protected configure(picker: IQuickPick<IEditorQuickPickItem>): void {
// Allow to open editors in background without closing picker
picker.canAcceptInBackground = true;
}
protected getPicks(filter: string): Array<IEditorQuickPickItem | IQuickPickSeparator> {
const query = prepareQuery(filter);
const scorerCache = Object.create(null);
@@ -108,7 +114,7 @@ export abstract class BaseEditorQuickAccessProvider extends PickerQuickAccessPro
return TriggerAction.REFRESH_PICKER;
},
accept: () => this.editorGroupService.getGroup(groupId)?.openEditor(editor),
accept: (keyMods, event) => this.editorGroupService.getGroup(groupId)?.openEditor(editor, { preserveFocus: event.inBackground }),
};
});
}

View File

@@ -260,9 +260,6 @@ export class NoTabsTitleControl extends TitleControl {
this.updateEditorDirty(editor);
// Editor Label
const resource = toResource(editor, { supportSideBySide: SideBySideEditor.MASTER });
const name = editor.getName();
const { labelFormat } = this.accessor.partOptions;
let description: string;
if (this.breadcrumbsControl && !this.breadcrumbsControl.isHidden()) {
@@ -278,7 +275,19 @@ export class NoTabsTitleControl extends TitleControl {
title = ''; // dont repeat what is already shown
}
editorLabel.setResource({ name, description, resource }, { title: typeof title === 'string' ? title : undefined, italic: !isEditorPinned, extraClasses: ['no-tabs', 'title-label'] });
editorLabel.setResource(
{
resource: toResource(editor, { supportSideBySide: SideBySideEditor.BOTH }),
name: editor.getName(),
description
},
{
title,
italic: !isEditorPinned,
extraClasses: ['no-tabs', 'title-label']
}
);
if (isGroupActive) {
editorLabel.element.style.color = this.getColor(TAB_ACTIVE_FOREGROUND) || '';
} else {

View File

@@ -975,11 +975,15 @@ export class TabsTitleControl extends TitleControl {
tabContainer.title = title;
// Label
const resource = toResource(editor, { supportSideBySide: SideBySideEditor.MASTER });
tabLabelWidget.setResource({ name, description, resource }, { title, extraClasses: ['tab-label'], italic: !this.group.isPinned(editor) });
tabLabelWidget.setResource(
{ name, description, resource: toResource(editor, { supportSideBySide: SideBySideEditor.BOTH }) },
{ title, extraClasses: ['tab-label'], italic: !this.group.isPinned(editor) }
);
this.setEditorTabColor(editor, tabContainer, this.group.isActive(editor)); // {{SQL CARBON EDIT}} -- Display the editor's tab color
// Tests helper
const resource = toResource(editor, { supportSideBySide: SideBySideEditor.MASTER });
if (resource) {
tabContainer.setAttribute('data-resource-name', basenameOrAuthority(resource));
} else {

View File

@@ -151,7 +151,10 @@ class NotificationMessageRenderer {
const anchor = $('a', { href: node.href, title: title, }, node.label);
if (actionHandler) {
actionHandler.toDispose.add(addDisposableListener(anchor, EventType.CLICK, () => actionHandler.callback(node.href)));
actionHandler.toDispose.add(addDisposableListener(anchor, EventType.CLICK, e => {
EventHelper.stop(e, true);
actionHandler.callback(node.href);
}));
}
messageContainer.appendChild(anchor);

View File

@@ -171,6 +171,10 @@
background-repeat: no-repeat;
}
.customview-tree .monaco-list .custom-view-tree-node-item .actions .action-label.codicon {
line-height: 22px;
}
.customview-tree .monaco-list .custom-view-tree-node-item .actions .action-label.codicon::before {
vertical-align: middle;
}

View File

@@ -343,7 +343,7 @@ export abstract class ViewPane extends Pane implements IView {
}
if (this.progressIndicator === undefined) {
this.progressIndicator = this.instantiationService.createInstance(CompositeProgressIndicator, assertIsDefined(this.progressBar), this.id, this.isVisible(), { exclusiveProgressBar: true });
this.progressIndicator = this.instantiationService.createInstance(CompositeProgressIndicator, assertIsDefined(this.progressBar), this.id, this.isVisible());
}
return this.progressIndicator;
}