mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-30 16:50:30 -04:00
Merge from vscode 2cfc8172e533e50c90e6a3152f6bfb1f82f963f3 (#6516)
* Merge from vscode 2cfc8172e533e50c90e6a3152f6bfb1f82f963f3 * fix tests
This commit is contained in:
@@ -72,13 +72,11 @@ export class ViewletActivityAction extends ActivityAction {
|
||||
}
|
||||
|
||||
private logAction(action: string) {
|
||||
/* __GDPR__
|
||||
"activityBarAction" : {
|
||||
"viewletId": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"action": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
this.telemetryService.publicLog('activityBarAction', { viewletId: this.activity.id, action });
|
||||
type ActivityBarActionClassification = {
|
||||
viewletId: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
|
||||
action: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
|
||||
};
|
||||
this.telemetryService.publicLog2<{ viewletId: String, action: String }, ActivityBarActionClassification>('activityBarAction', { viewletId: this.activity.id, action });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +163,7 @@ export class GlobalActivityActionViewItem extends ActivityActionViewItem {
|
||||
export class PlaceHolderViewletActivityAction extends ViewletActivityAction {
|
||||
|
||||
constructor(
|
||||
id: string, iconUrl: URI,
|
||||
id: string, name: string, iconUrl: URI,
|
||||
@IViewletService viewletService: IViewletService,
|
||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
|
||||
@ITelemetryService telemetryService: ITelemetryService
|
||||
|
||||
@@ -34,9 +34,11 @@ import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
import { IActivityBarService } from 'vs/workbench/services/activityBar/browser/activityBarService';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
|
||||
interface ICachedViewlet {
|
||||
id: string;
|
||||
name?: string;
|
||||
iconUrl?: UriComponents;
|
||||
pinned: boolean;
|
||||
order?: number;
|
||||
@@ -78,18 +80,23 @@ export class ActivitybarPart extends Part implements IActivityBarService {
|
||||
@IStorageService private readonly storageService: IStorageService,
|
||||
@IExtensionService private readonly extensionService: IExtensionService,
|
||||
@IViewsService private readonly viewsService: IViewsService,
|
||||
@IContextKeyService private readonly contextKeyService: IContextKeyService
|
||||
@IContextKeyService private readonly contextKeyService: IContextKeyService,
|
||||
@IWorkbenchEnvironmentService workbenchEnvironmentService: IWorkbenchEnvironmentService,
|
||||
) {
|
||||
super(Parts.ACTIVITYBAR_PART, { hasTitle: false }, themeService, storageService, layoutService);
|
||||
|
||||
this.cachedViewlets = this.getCachedViewlets();
|
||||
for (const cachedViewlet of this.cachedViewlets) {
|
||||
if (this.shouldBeHidden(cachedViewlet.id, cachedViewlet)) {
|
||||
if (workbenchEnvironmentService.configuration.remoteAuthority // In remote window, hide activity bar entries until registered.
|
||||
|| this.shouldBeHidden(cachedViewlet.id, cachedViewlet)
|
||||
) {
|
||||
cachedViewlet.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
this.compositeBar = this._register(this.instantiationService.createInstance(CompositeBar, this.cachedViewlets.map(v => ({ id: v.id, name: undefined, visible: v.visible, order: v.order, pinned: v.pinned })), {
|
||||
const cachedItems = this.cachedViewlets
|
||||
.map(v => ({ id: v.id, name: v.name, visible: v.visible, order: v.order, pinned: v.pinned }));
|
||||
this.compositeBar = this._register(this.instantiationService.createInstance(CompositeBar, cachedItems, {
|
||||
icon: true,
|
||||
orientation: ActionsOrientation.VERTICAL,
|
||||
openComposite: (compositeId: string) => this.viewletService.openViewlet(compositeId, true),
|
||||
@@ -252,7 +259,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
|
||||
} else {
|
||||
const cachedComposite = this.cachedViewlets.filter(c => c.id === compositeId)[0];
|
||||
compositeActions = {
|
||||
activityAction: this.instantiationService.createInstance(PlaceHolderViewletActivityAction, compositeId, cachedComposite && cachedComposite.iconUrl ? URI.revive(cachedComposite.iconUrl) : undefined),
|
||||
activityAction: this.instantiationService.createInstance(PlaceHolderViewletActivityAction, compositeId, cachedComposite && cachedComposite.name ? cachedComposite.name : compositeId, cachedComposite && cachedComposite.iconUrl ? URI.revive(cachedComposite.iconUrl) : undefined),
|
||||
pinnedAction: new PlaceHolderToggleCompositePinnedAction(compositeId, this.compositeBar)
|
||||
};
|
||||
}
|
||||
@@ -312,7 +319,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
|
||||
}
|
||||
}
|
||||
|
||||
private shouldBeHidden(viewletId: string, cachedViewlet: ICachedViewlet): boolean {
|
||||
private shouldBeHidden(viewletId: string, cachedViewlet?: ICachedViewlet): boolean {
|
||||
const viewContainer = this.getViewContainer(viewletId);
|
||||
if (!viewContainer || !viewContainer.hideIfEmpty) {
|
||||
return false;
|
||||
@@ -428,7 +435,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
|
||||
}
|
||||
}
|
||||
}
|
||||
state.push({ id: compositeItem.id, iconUrl: viewlet.iconUrl && viewlet.iconUrl.scheme === Schemas.file ? viewlet.iconUrl : undefined, views, pinned: compositeItem.pinned, order: compositeItem.order, visible: compositeItem.visible });
|
||||
state.push({ id: compositeItem.id, name: viewlet.name, iconUrl: viewlet.iconUrl && viewlet.iconUrl.scheme === Schemas.file ? viewlet.iconUrl : undefined, views, pinned: compositeItem.pinned, order: compositeItem.order, visible: compositeItem.visible });
|
||||
} else {
|
||||
state.push({ id: compositeItem.id, pinned: compositeItem.pinned, order: compositeItem.order, visible: false });
|
||||
}
|
||||
@@ -440,7 +447,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
|
||||
private getCachedViewlets(): ICachedViewlet[] {
|
||||
const storedStates: Array<string | ICachedViewlet> = JSON.parse(this.cachedViewletsValue);
|
||||
const cachedViewlets = storedStates.map(c => {
|
||||
const serialized: ICachedViewlet = typeof c === 'string' /* migration from pinned states to composites states */ ? { id: c, pinned: true, order: undefined, visible: true, iconUrl: undefined, views: undefined } : c;
|
||||
const serialized: ICachedViewlet = typeof c === 'string' /* migration from pinned states to composites states */ ? { id: c, pinned: true, order: undefined, visible: true, name: undefined, iconUrl: undefined, views: undefined } : c;
|
||||
serialized.visible = isUndefinedOrNull(serialized.visible) ? true : serialized.visible;
|
||||
return serialized;
|
||||
});
|
||||
@@ -448,6 +455,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
|
||||
for (const old of this.loadOldCachedViewlets()) {
|
||||
const cachedViewlet = cachedViewlets.filter(cached => cached.id === old.id)[0];
|
||||
if (cachedViewlet) {
|
||||
cachedViewlet.name = old.name;
|
||||
cachedViewlet.iconUrl = old.iconUrl;
|
||||
cachedViewlet.views = old.views;
|
||||
}
|
||||
|
||||
@@ -466,6 +466,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
|
||||
}
|
||||
|
||||
layout(width: number, height: number): void {
|
||||
super.layout(width, height);
|
||||
|
||||
// Layout contents
|
||||
this.contentAreaSize = super.layoutContents(width, height).contentSize;
|
||||
|
||||
@@ -304,12 +304,10 @@ export class BreadcrumbsControl {
|
||||
const { element } = event.item as Item;
|
||||
this._editorGroup.focus();
|
||||
|
||||
/* __GDPR__
|
||||
"breadcrumbs/select" : {
|
||||
"type": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
this._telemetryService.publicLog('breadcrumbs/select', { type: element instanceof TreeElement ? 'symbol' : 'file' });
|
||||
type BreadcrumbSelectClassification = {
|
||||
type: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
|
||||
};
|
||||
this._telemetryService.publicLog2<{ type: string }, BreadcrumbSelectClassification>('breadcrumbs/select', { type: element instanceof TreeElement ? 'symbol' : 'file' });
|
||||
|
||||
const group = this._getEditorGroup(event.payload);
|
||||
if (group !== undefined) {
|
||||
|
||||
@@ -25,10 +25,9 @@ import { ResourceLabels, IResourceLabel, DEFAULT_LABELS_CONTAINER } from 'vs/wor
|
||||
import { BreadcrumbsConfig } from 'vs/workbench/browser/parts/editor/breadcrumbs';
|
||||
import { BreadcrumbElement, FileElement } from 'vs/workbench/browser/parts/editor/breadcrumbsModel';
|
||||
import { IFileIconTheme, IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
import { IAsyncDataSource, ITreeRenderer, ITreeNode, ITreeFilter, TreeVisibility, ITreeSorter, IDataSource } from 'vs/base/browser/ui/tree/tree';
|
||||
import { OutlineVirtualDelegate, OutlineGroupRenderer, OutlineElementRenderer, OutlineItemComparator, OutlineIdentityProvider, OutlineNavigationLabelProvider, OutlineDataSource, OutlineSortOrder, OutlineItem } from 'vs/editor/contrib/documentSymbols/outlineTree';
|
||||
import { IAsyncDataSource, ITreeRenderer, ITreeNode, ITreeFilter, TreeVisibility, ITreeSorter } from 'vs/base/browser/ui/tree/tree';
|
||||
import { OutlineVirtualDelegate, OutlineGroupRenderer, OutlineElementRenderer, OutlineItemComparator, OutlineIdentityProvider, OutlineNavigationLabelProvider, OutlineDataSource, OutlineSortOrder } from 'vs/editor/contrib/documentSymbols/outlineTree';
|
||||
import { IIdentityProvider, IListVirtualDelegate, IKeyboardNavigationLabelProvider } from 'vs/base/browser/ui/list/list';
|
||||
import { IDataTreeOptions } from 'vs/base/browser/ui/tree/dataTree';
|
||||
|
||||
export function createBreadcrumbsPicker(instantiationService: IInstantiationService, parent: HTMLElement, element: BreadcrumbElement): BreadcrumbsPicker {
|
||||
const ctor: IConstructorSignature1<HTMLElement, BreadcrumbsPicker> = element instanceof FileElement
|
||||
@@ -381,7 +380,7 @@ export class BreadcrumbsFilePicker extends BreadcrumbsPicker {
|
||||
filter: this._instantiationService.createInstance(FileFilter),
|
||||
identityProvider: new FileIdentityProvider(),
|
||||
keyboardNavigationLabelProvider: new FileNavigationLabelProvider()
|
||||
}) as WorkbenchAsyncDataTree<BreadcrumbElement | IFileStat, any, FuzzyScore>;
|
||||
});
|
||||
}
|
||||
|
||||
_setInput(element: BreadcrumbElement): Promise<void> {
|
||||
@@ -439,14 +438,7 @@ export class BreadcrumbsOutlinePicker extends BreadcrumbsPicker {
|
||||
}
|
||||
|
||||
protected _createTree(container: HTMLElement) {
|
||||
return this._instantiationService.createInstance<
|
||||
HTMLElement,
|
||||
IListVirtualDelegate<OutlineItem>,
|
||||
ITreeRenderer<any, FuzzyScore, any>[],
|
||||
IDataSource<OutlineModel, OutlineItem>,
|
||||
IDataTreeOptions<OutlineItem, FuzzyScore>,
|
||||
WorkbenchDataTree<OutlineModel, OutlineItem, FuzzyScore>
|
||||
>(
|
||||
return this._instantiationService.createInstance(
|
||||
WorkbenchDataTree,
|
||||
container,
|
||||
new OutlineVirtualDelegate(),
|
||||
@@ -459,7 +451,7 @@ export class BreadcrumbsOutlinePicker extends BreadcrumbsPicker {
|
||||
identityProvider: new OutlineIdentityProvider(),
|
||||
keyboardNavigationLabelProvider: new OutlineNavigationLabelProvider()
|
||||
}
|
||||
) as WorkbenchDataTree<OutlineModel, OutlineItem, FuzzyScore>;
|
||||
);
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
|
||||
@@ -453,7 +453,7 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.
|
||||
|
||||
interface IEditorToolItem { id: string; title: string; iconDark: string; iconLight: string; }
|
||||
|
||||
function appendEditorToolItem(primary: IEditorToolItem, when: ContextKeyExpr, order: number, alternative?: IEditorToolItem): void {
|
||||
function appendEditorToolItem(primary: IEditorToolItem, when: ContextKeyExpr | undefined, order: number, alternative?: IEditorToolItem): void {
|
||||
const item: IMenuItem = {
|
||||
command: {
|
||||
id: primary.id,
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Event, Emitter, Relay } from 'vs/base/common/event';
|
||||
import { contrastBorder, editorBackground } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { GroupDirection, IAddGroupOptions, GroupsArrangement, GroupOrientation, IMergeGroupOptions, MergeGroupMode, ICopyEditorOptions, GroupsOrder, GroupChangeKind, GroupLocation, IFindGroupScope, EditorGroupLayout, GroupLayoutArgument, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { IInstantiationService, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Direction, SerializableGrid, Sizing, ISerializedGrid, Orientation, GridBranchNode, isGridBranchNode, GridNode, createSerializedGrid, Grid } from 'vs/base/browser/ui/grid/grid';
|
||||
import { IView, orthogonal, LayoutPriority, IViewSize, Direction, SerializableGrid, Sizing, ISerializedGrid, Orientation, GridBranchNode, isGridBranchNode, GridNode, createSerializedGrid, Grid } from 'vs/base/browser/ui/grid/grid';
|
||||
import { GroupIdentifier, IWorkbenchEditorConfiguration, IEditorPartOptions } from 'vs/workbench/common/editor';
|
||||
import { values } from 'vs/base/common/map';
|
||||
import { EDITOR_GROUP_BORDER, EDITOR_PANE_BACKGROUND } from 'vs/workbench/common/theme';
|
||||
@@ -27,7 +27,6 @@ import { EditorDropTarget } from 'vs/workbench/browser/parts/editor/editorDropTa
|
||||
import { localize } from 'vs/nls';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { CenteredViewLayout } from 'vs/base/browser/ui/centered/centeredViewLayout';
|
||||
import { IView, orthogonal, LayoutPriority, IViewSize } from 'vs/base/browser/ui/grid/gridview';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { Parts, IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
@@ -112,13 +111,8 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
|
||||
private _onDidSizeConstraintsChange = this._register(new Relay<{ width: number; height: number; } | undefined>());
|
||||
get onDidSizeConstraintsChange(): Event<{ width: number; height: number; } | undefined> { return Event.any(this.onDidSetGridWidget.event, this._onDidSizeConstraintsChange.event); }
|
||||
|
||||
private readonly _onDidPreferredSizeChange: Emitter<void> = this._register(new Emitter<void>());
|
||||
readonly onDidPreferredSizeChange: Event<void> = this._onDidPreferredSizeChange.event;
|
||||
|
||||
//#endregion
|
||||
|
||||
private _preferredSize: Dimension | undefined;
|
||||
|
||||
private readonly workspaceMemento: MementoObject;
|
||||
private readonly globalMemento: MementoObject;
|
||||
|
||||
@@ -205,8 +199,8 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
|
||||
|
||||
//#region IEditorGroupsService
|
||||
|
||||
private _dimension: Dimension;
|
||||
get dimension(): Dimension { return this._dimension; }
|
||||
private _contentDimension: Dimension;
|
||||
get contentDimension(): Dimension { return this._contentDimension; }
|
||||
|
||||
get activeGroup(): IEditorGroupView {
|
||||
return this._activeGroup;
|
||||
@@ -366,9 +360,6 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
|
||||
const newOrientation = (orientation === GroupOrientation.HORIZONTAL) ? Orientation.HORIZONTAL : Orientation.VERTICAL;
|
||||
if (this.gridWidget.orientation !== newOrientation) {
|
||||
this.gridWidget.orientation = newOrientation;
|
||||
|
||||
// Mark preferred size as changed
|
||||
this.resetPreferredSize();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -418,14 +409,11 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
|
||||
this.doCreateGridControlWithState(gridDescriptor, activeGroup.id, currentGroupViews);
|
||||
|
||||
// Layout
|
||||
this.doLayout(this._dimension);
|
||||
this.doLayout(this._contentDimension);
|
||||
|
||||
// Update container
|
||||
this.updateContainer();
|
||||
|
||||
// Mark preferred size as changed
|
||||
this.resetPreferredSize();
|
||||
|
||||
// Events for groups that got added
|
||||
this.getGroups(GroupsOrder.GRID_APPEARANCE).forEach(groupView => {
|
||||
if (currentGroupViews.indexOf(groupView) === -1) {
|
||||
@@ -490,9 +478,6 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
|
||||
// Update container
|
||||
this.updateContainer();
|
||||
|
||||
// Mark preferred size as changed
|
||||
this.resetPreferredSize();
|
||||
|
||||
// Event
|
||||
this._onDidAddGroup.fire(newGroupView);
|
||||
|
||||
@@ -661,9 +646,6 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
|
||||
// Update container
|
||||
this.updateContainer();
|
||||
|
||||
// Mark preferred size as changed
|
||||
this.resetPreferredSize();
|
||||
|
||||
// Event
|
||||
this._onDidRemoveGroup.fire(groupView);
|
||||
}
|
||||
@@ -764,23 +746,6 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
|
||||
get onDidChange(): Event<IViewSize | undefined> { return this.centeredLayoutWidget.onDidChange; }
|
||||
readonly priority: LayoutPriority = LayoutPriority.High;
|
||||
|
||||
get preferredSize(): Dimension {
|
||||
if (!this._preferredSize) {
|
||||
this._preferredSize = new Dimension(this.gridWidget.minimumWidth, this.gridWidget.minimumHeight);
|
||||
}
|
||||
|
||||
return this._preferredSize;
|
||||
}
|
||||
|
||||
private resetPreferredSize(): void {
|
||||
|
||||
// Reset (will be computed upon next access)
|
||||
this._preferredSize = undefined;
|
||||
|
||||
// Event
|
||||
this._onDidPreferredSizeChange.fire();
|
||||
}
|
||||
|
||||
private get gridSeparatorBorder(): Color {
|
||||
return this.theme.getColor(EDITOR_GROUP_BORDER) || this.theme.getColor(contrastBorder) || Color.transparent;
|
||||
}
|
||||
@@ -968,10 +933,10 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
|
||||
}
|
||||
|
||||
private doLayout(dimension: Dimension): void {
|
||||
this._dimension = dimension;
|
||||
this._contentDimension = dimension;
|
||||
|
||||
// Layout Grid
|
||||
this.centeredLayoutWidget.layout(this._dimension.width, this._dimension.height);
|
||||
this.centeredLayoutWidget.layout(this._contentDimension.width, this._contentDimension.height);
|
||||
|
||||
// Event
|
||||
this._onDidLayout.fire(dimension);
|
||||
@@ -1028,4 +993,4 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
|
||||
}
|
||||
}
|
||||
|
||||
registerSingleton(IEditorGroupsService, EditorPart);
|
||||
registerSingleton(IEditorGroupsService, EditorPart);
|
||||
|
||||
@@ -70,7 +70,7 @@ export class NotificationsList extends Themable {
|
||||
const renderer = this.instantiationService.createInstance(NotificationRenderer, actionRunner);
|
||||
|
||||
// List
|
||||
this.list = this._register(<WorkbenchList<INotificationViewItem>>this.instantiationService.createInstance(
|
||||
this.list = this._register(this.instantiationService.createInstance(
|
||||
WorkbenchList,
|
||||
this.listContainer,
|
||||
new NotificationsListDelegate(this.listContainer),
|
||||
|
||||
@@ -59,6 +59,16 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
|
||||
|
||||
readonly snap = true;
|
||||
|
||||
get preferredHeight(): number | undefined {
|
||||
const sidebarDimension = this.layoutService.getDimension(Parts.SIDEBAR_PART);
|
||||
return sidebarDimension.height * 0.4;
|
||||
}
|
||||
|
||||
get preferredWidth(): number | undefined {
|
||||
const statusbarPart = this.layoutService.getDimension(Parts.STATUSBAR_PART);
|
||||
return statusbarPart.width * 0.4;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
get onDidPanelOpen(): Event<{ panel: IPanel, focus: boolean }> { return Event.map(this.onDidCompositeOpen.event, compositeOpen => ({ panel: compositeOpen.composite, focus: compositeOpen.focus })); }
|
||||
@@ -74,7 +84,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
|
||||
private compositeActions: Map<string, { activityAction: PanelActivityAction, pinnedAction: ToggleCompositePinnedAction }> = new Map();
|
||||
|
||||
private blockOpeningPanel: boolean;
|
||||
private dimension: Dimension;
|
||||
private _contentDimension: Dimension;
|
||||
|
||||
constructor(
|
||||
@INotificationService notificationService: INotificationService,
|
||||
@@ -293,21 +303,21 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
|
||||
}
|
||||
|
||||
if (this.layoutService.getPanelPosition() === Position.RIGHT) {
|
||||
this.dimension = new Dimension(width - 1, height!); // Take into account the 1px border when layouting
|
||||
this._contentDimension = new Dimension(width - 1, height!); // Take into account the 1px border when layouting
|
||||
} else {
|
||||
this.dimension = new Dimension(width, height!);
|
||||
this._contentDimension = new Dimension(width, height!);
|
||||
}
|
||||
|
||||
// Layout contents
|
||||
super.layout(this.dimension.width, this.dimension.height);
|
||||
super.layout(this._contentDimension.width, this._contentDimension.height);
|
||||
|
||||
// Layout composite bar
|
||||
this.layoutCompositeBar();
|
||||
}
|
||||
|
||||
private layoutCompositeBar(): void {
|
||||
if (this.dimension) {
|
||||
let availableWidth = this.dimension.width - 40; // take padding into account
|
||||
if (this._contentDimension) {
|
||||
let availableWidth = this._contentDimension.width - 40; // take padding into account
|
||||
if (this.toolBar) {
|
||||
availableWidth = Math.max(PanelPart.MIN_COMPOSITE_BAR_WIDTH, availableWidth - this.getToolbarWidth()); // adjust height for global actions showing
|
||||
}
|
||||
@@ -522,4 +532,4 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
|
||||
}
|
||||
});
|
||||
|
||||
registerSingleton(IPanelService, PanelPart);
|
||||
registerSingleton(IPanelService, PanelPart);
|
||||
|
||||
@@ -252,7 +252,7 @@ export class QuickInputList {
|
||||
setRowLineHeight: false,
|
||||
multipleSelectionSupport: false,
|
||||
horizontalScrolling: false
|
||||
} as IListOptions<ListElement>) as WorkbenchList<ListElement>;
|
||||
} as IListOptions<ListElement>);
|
||||
this.list.getHTMLElement().id = id;
|
||||
this.disposables.push(this.list);
|
||||
this.disposables.push(this.list.onKeyDown(e => {
|
||||
|
||||
@@ -47,6 +47,22 @@ export class SidebarPart extends CompositePart<Viewlet> implements IViewletServi
|
||||
|
||||
readonly snap = true;
|
||||
|
||||
get preferredWidth(): number | undefined {
|
||||
const viewlet = this.getActiveViewlet();
|
||||
|
||||
if (!viewlet) {
|
||||
return undefined; // {{SQL CARBON EDIT}} strict-null-check
|
||||
}
|
||||
|
||||
const width = viewlet.getOptimalWidth();
|
||||
|
||||
if (typeof width !== 'number') {
|
||||
return undefined; // {{SQL CARBON EDIT}} strict-null-check
|
||||
}
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
get onDidViewletRegister(): Event<ViewletDescriptor> { return <Event<ViewletDescriptor>>this.viewletRegistry.onDidRegister; }
|
||||
@@ -303,4 +319,4 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(FocusSideBarAction, Fo
|
||||
primary: KeyMod.CtrlCmd | KeyCode.KEY_0
|
||||
}), 'View: Focus into Side Bar', nls.localize('viewCategory', "View"));
|
||||
|
||||
registerSingleton(IViewletService, SidebarPart);
|
||||
registerSingleton(IViewletService, SidebarPart);
|
||||
|
||||
@@ -611,6 +611,7 @@ export class StatusbarPart extends Part implements IStatusbarService {
|
||||
}
|
||||
|
||||
layout(width: number, height: number): void {
|
||||
super.layout(width, height);
|
||||
super.layoutContents(width, height);
|
||||
}
|
||||
|
||||
@@ -816,4 +817,4 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
|
||||
}
|
||||
});
|
||||
|
||||
registerSingleton(IStatusbarService, StatusbarPart);
|
||||
registerSingleton(IStatusbarService, StatusbarPart);
|
||||
|
||||
@@ -385,13 +385,17 @@ export class CustomTreeView extends Disposable implements ITreeView {
|
||||
collapseByDefault: (e: ITreeItem): boolean => {
|
||||
return e.collapsibleState !== TreeItemCollapsibleState.Expanded;
|
||||
}
|
||||
}) as WorkbenchAsyncDataTree<ITreeItem, ITreeItem, FuzzyScore>);
|
||||
}));
|
||||
aligner.tree = this.tree;
|
||||
|
||||
this.tree.contextKeyService.createKey<boolean>(this.id, true);
|
||||
this._register(this.tree.onContextMenu(e => this.onContextMenu(treeMenus, e)));
|
||||
this._register(this.tree.onDidChangeSelection(e => this._onDidChangeSelection.fire(e.elements)));
|
||||
this._register(this.tree.onDidChangeCollapseState(e => {
|
||||
if (!e.node.element) {
|
||||
return;
|
||||
}
|
||||
|
||||
const element: ITreeItem = Array.isArray(e.node.element.element) ? e.node.element.element[0] : e.node.element.element;
|
||||
if (e.node.collapsed) {
|
||||
this._onDidCollapseItem.fire(element);
|
||||
|
||||
@@ -238,6 +238,9 @@ export class ContributableViewsModel extends Disposable {
|
||||
private _onDidMove = this._register(new Emitter<{ from: IViewDescriptorRef; to: IViewDescriptorRef; }>());
|
||||
readonly onDidMove: Event<{ from: IViewDescriptorRef; to: IViewDescriptorRef; }> = this._onDidMove.event;
|
||||
|
||||
private _onDidChangeViewState = this._register(new Emitter<IViewDescriptorRef>());
|
||||
protected readonly onDidChangeViewState: Event<IViewDescriptorRef> = this._onDidChangeViewState.event;
|
||||
|
||||
constructor(
|
||||
container: ViewContainer,
|
||||
viewsService: IViewsService,
|
||||
@@ -301,8 +304,11 @@ export class ContributableViewsModel extends Disposable {
|
||||
}
|
||||
|
||||
setCollapsed(id: string, collapsed: boolean): void {
|
||||
const { state } = this.find(id);
|
||||
state.collapsed = collapsed;
|
||||
const { index, state, viewDescriptor } = this.find(id);
|
||||
if (state.collapsed !== collapsed) {
|
||||
state.collapsed = collapsed;
|
||||
this._onDidChangeViewState.fire({ viewDescriptor, index });
|
||||
}
|
||||
}
|
||||
|
||||
getSize(id: string): number | undefined {
|
||||
@@ -316,8 +322,11 @@ export class ContributableViewsModel extends Disposable {
|
||||
}
|
||||
|
||||
setSize(id: string, size: number): void {
|
||||
const { state } = this.find(id);
|
||||
state.size = size;
|
||||
const { index, state, viewDescriptor } = this.find(id);
|
||||
if (state.size !== size) {
|
||||
state.size = size;
|
||||
this._onDidChangeViewState.fire({ viewDescriptor, index });
|
||||
}
|
||||
}
|
||||
|
||||
move(from: string, to: string): void {
|
||||
@@ -474,12 +483,15 @@ export class PersistentContributableViewsModel extends ContributableViewsModel {
|
||||
this.hiddenViewsStorageId = hiddenViewsStorageId;
|
||||
this.storageService = storageService;
|
||||
|
||||
this._register(this.onDidAdd(viewDescriptorRefs => this.saveVisibilityStates(viewDescriptorRefs.map(r => r.viewDescriptor))));
|
||||
this._register(this.onDidRemove(viewDescriptorRefs => this.saveVisibilityStates(viewDescriptorRefs.map(r => r.viewDescriptor))));
|
||||
this._register(this.storageService.onWillSaveState(() => this.saveViewsStates()));
|
||||
this._register(Event.any(
|
||||
this.onDidAdd,
|
||||
this.onDidRemove,
|
||||
Event.map(this.onDidMove, ({ from, to }) => [from, to]),
|
||||
Event.map(this.onDidChangeViewState, viewDescriptorRef => [viewDescriptorRef]))
|
||||
(viewDescriptorRefs => this.saveViewsStates(viewDescriptorRefs.map(r => r.viewDescriptor))));
|
||||
}
|
||||
|
||||
private saveViewsStates(): void {
|
||||
private saveViewsStates(viewDescriptors: IViewDescriptor[]): void {
|
||||
const storedViewsStates: { [id: string]: { collapsed: boolean, size?: number, order?: number } } = {};
|
||||
|
||||
let hasState = false;
|
||||
@@ -496,6 +508,8 @@ export class PersistentContributableViewsModel extends ContributableViewsModel {
|
||||
} else {
|
||||
this.storageService.remove(this.viewletStateStorageId, StorageScope.WORKSPACE);
|
||||
}
|
||||
|
||||
this.saveVisibilityStates(viewDescriptors);
|
||||
}
|
||||
|
||||
private saveVisibilityStates(viewDescriptors: IViewDescriptor[]): void {
|
||||
@@ -725,4 +739,4 @@ export function createFileIconThemableTreeContainerScope(container: HTMLElement,
|
||||
return themeService.onDidFileIconThemeChange(onDidChangeFileIconTheme);
|
||||
}
|
||||
|
||||
registerSingleton(IViewsService, ViewsService);
|
||||
registerSingleton(IViewsService, ViewsService);
|
||||
|
||||
@@ -263,13 +263,11 @@ export abstract class ViewContainerViewlet extends PanelViewlet implements IView
|
||||
|
||||
private toggleViewVisibility(viewId: string): void {
|
||||
const visible = !this.viewsModel.isVisible(viewId);
|
||||
/* __GDPR__
|
||||
"views.toggleVisibility" : {
|
||||
"viewId" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"visible": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
this.telemetryService.publicLog('views.toggledVisibility', { viewId, visible });
|
||||
type ViewsToggleVisibilityClassification = {
|
||||
viewId: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
|
||||
visible: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
|
||||
};
|
||||
this.telemetryService.publicLog2<{ viewId: String, visible: boolean }, ViewsToggleVisibilityClassification>('views.toggleVisibility', { viewId, visible });
|
||||
this.viewsModel.setVisible(viewId, visible);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user