mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Merge from vscode ec07311dab2556c9d66a4cb3eecdc21c524202e1 (#6739)
This commit is contained in:
@@ -71,6 +71,7 @@ export abstract class BreadcrumbsConfig<T> {
|
||||
static FilePath = BreadcrumbsConfig._stub<'on' | 'off' | 'last'>('breadcrumbs.filePath');
|
||||
static SymbolPath = BreadcrumbsConfig._stub<'on' | 'off' | 'last'>('breadcrumbs.symbolPath');
|
||||
static SymbolSortOrder = BreadcrumbsConfig._stub<'position' | 'name' | 'type'>('breadcrumbs.symbolSortOrder');
|
||||
static Icons = BreadcrumbsConfig._stub<boolean>('breadcrumbs.icons');
|
||||
|
||||
static FileExcludes = BreadcrumbsConfig._stub<glob.IExpression>('files.exclude');
|
||||
|
||||
@@ -160,6 +161,11 @@ Registry.as<IConfigurationRegistry>(Extensions.Configuration).registerConfigurat
|
||||
localize('symbolSortOrder.name', "Show symbol outline in alphabetical order."),
|
||||
localize('symbolSortOrder.type', "Show symbol outline in symbol type order."),
|
||||
]
|
||||
},
|
||||
'breadcrumbs.icons': {
|
||||
description: localize('icons', "Render breadcrumb items with icons."),
|
||||
type: 'boolean',
|
||||
default: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -69,7 +69,9 @@ class Item extends BreadcrumbsItem {
|
||||
return false;
|
||||
}
|
||||
if (this.element instanceof FileElement && other.element instanceof FileElement) {
|
||||
return isEqual(this.element.uri, other.element.uri, false);
|
||||
return (isEqual(this.element.uri, other.element.uri, false) &&
|
||||
this.options.showFileIcons === other.options.showFileIcons &&
|
||||
this.options.showSymbolIcons === other.options.showSymbolIcons);
|
||||
}
|
||||
if (this.element instanceof TreeElement && other.element instanceof TreeElement) {
|
||||
return this.element.id === other.element.id;
|
||||
@@ -143,6 +145,7 @@ export class BreadcrumbsControl {
|
||||
private readonly _ckBreadcrumbsActive: IContextKey<boolean>;
|
||||
|
||||
private readonly _cfUseQuickPick: BreadcrumbsConfig<boolean>;
|
||||
private readonly _cfShowIcons: BreadcrumbsConfig<boolean>;
|
||||
|
||||
readonly domNode: HTMLDivElement;
|
||||
private readonly _widget: BreadcrumbsWidget;
|
||||
@@ -185,6 +188,7 @@ export class BreadcrumbsControl {
|
||||
this._ckBreadcrumbsActive = BreadcrumbsControl.CK_BreadcrumbsActive.bindTo(this._contextKeyService);
|
||||
|
||||
this._cfUseQuickPick = BreadcrumbsConfig.UseQuickPick.bindTo(_configurationService);
|
||||
this._cfShowIcons = BreadcrumbsConfig.Icons.bindTo(_configurationService);
|
||||
|
||||
this._disposables.add(breadcrumbsService.register(this._editorGroup.id, this._widget));
|
||||
}
|
||||
@@ -196,6 +200,7 @@ export class BreadcrumbsControl {
|
||||
this._ckBreadcrumbsVisible.reset();
|
||||
this._ckBreadcrumbsActive.reset();
|
||||
this._cfUseQuickPick.dispose();
|
||||
this._cfShowIcons.dispose();
|
||||
this._widget.dispose();
|
||||
this.domNode.remove();
|
||||
}
|
||||
@@ -246,15 +251,23 @@ export class BreadcrumbsControl {
|
||||
dom.toggleClass(this.domNode, 'backslash-path', this._labelService.getSeparator(uri.scheme, uri.authority) === '\\');
|
||||
|
||||
const updateBreadcrumbs = () => {
|
||||
const items = model.getElements().map(element => new Item(element, this._options, this._instantiationService));
|
||||
const showIcons = this._cfShowIcons.getValue();
|
||||
const options: IBreadcrumbsControlOptions = {
|
||||
...this._options,
|
||||
showFileIcons: this._options.showFileIcons && showIcons,
|
||||
showSymbolIcons: this._options.showSymbolIcons && showIcons
|
||||
};
|
||||
const items = model.getElements().map(element => new Item(element, options, this._instantiationService));
|
||||
this._widget.setItems(items);
|
||||
this._widget.reveal(items[items.length - 1]);
|
||||
};
|
||||
const listener = model.onDidUpdate(updateBreadcrumbs);
|
||||
const configListener = this._cfShowIcons.onDidChange(updateBreadcrumbs);
|
||||
updateBreadcrumbs();
|
||||
this._breadcrumbsDisposables.clear();
|
||||
this._breadcrumbsDisposables.add(model);
|
||||
this._breadcrumbsDisposables.add(listener);
|
||||
this._breadcrumbsDisposables.add(configListener);
|
||||
|
||||
// close picker on hide/update
|
||||
this._breadcrumbsDisposables.add({
|
||||
|
||||
@@ -806,7 +806,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
|
||||
|
||||
//#region openEditor()
|
||||
|
||||
openEditor(editor: EditorInput, options?: EditorOptions): Promise<IEditor | null> {
|
||||
async openEditor(editor: EditorInput, options?: EditorOptions): Promise<IEditor | null> {
|
||||
|
||||
// Guard against invalid inputs
|
||||
if (!editor) {
|
||||
@@ -822,7 +822,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
|
||||
}
|
||||
|
||||
// Proceed with opening
|
||||
return this.doOpenEditor(editor, options).then(withUndefinedAsNull);
|
||||
return withUndefinedAsNull(await this.doOpenEditor(editor, options));
|
||||
}
|
||||
|
||||
private doOpenEditor(editor: EditorInput, options?: EditorOptions): Promise<IEditor | undefined> {
|
||||
|
||||
@@ -63,7 +63,7 @@ export class SidebarPart extends CompositePart<Viewlet> implements IViewletServi
|
||||
return undefined; // {{SQL CARBON EDIT}} strict-null-check
|
||||
}
|
||||
|
||||
return width;
|
||||
return Math.max(width, 300);
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
@@ -161,12 +161,12 @@ export class CustomTreeView extends Disposable implements ITreeView {
|
||||
private _showCollapseAllAction = false;
|
||||
|
||||
private focused: boolean = false;
|
||||
private domNode: HTMLElement;
|
||||
private treeContainer: HTMLElement;
|
||||
private domNode!: HTMLElement;
|
||||
private treeContainer!: HTMLElement;
|
||||
private _messageValue: string | undefined;
|
||||
private messageElement: HTMLDivElement;
|
||||
private tree: WorkbenchAsyncDataTree<ITreeItem, ITreeItem, FuzzyScore>;
|
||||
private treeLabels: ResourceLabels;
|
||||
private messageElement!: HTMLDivElement;
|
||||
private tree: WorkbenchAsyncDataTree<ITreeItem, ITreeItem, FuzzyScore> | undefined;
|
||||
private treeLabels: ResourceLabels | undefined;
|
||||
private root: ITreeItem;
|
||||
private elementsToRefresh: ITreeItem[] = [];
|
||||
private menus: TitleMenus;
|
||||
@@ -218,12 +218,12 @@ export class CustomTreeView extends Disposable implements ITreeView {
|
||||
this.create();
|
||||
}
|
||||
|
||||
private _dataProvider: ITreeViewDataProvider | null;
|
||||
get dataProvider(): ITreeViewDataProvider | null {
|
||||
private _dataProvider: ITreeViewDataProvider | undefined;
|
||||
get dataProvider(): ITreeViewDataProvider | undefined {
|
||||
return this._dataProvider;
|
||||
}
|
||||
|
||||
set dataProvider(dataProvider: ITreeViewDataProvider | null) {
|
||||
set dataProvider(dataProvider: ITreeViewDataProvider | undefined) {
|
||||
if (dataProvider) {
|
||||
this._dataProvider = new class implements ITreeViewDataProvider {
|
||||
async getChildren(node: ITreeItem): Promise<ITreeItem[]> {
|
||||
@@ -238,7 +238,7 @@ export class CustomTreeView extends Disposable implements ITreeView {
|
||||
this.updateMessage();
|
||||
this.refresh();
|
||||
} else {
|
||||
this._dataProvider = null;
|
||||
this._dataProvider = undefined;
|
||||
this.updateMessage();
|
||||
}
|
||||
}
|
||||
@@ -399,7 +399,7 @@ export class CustomTreeView extends Disposable implements ITreeView {
|
||||
if (!e.browserEvent) {
|
||||
return;
|
||||
}
|
||||
const selection = this.tree.getSelection();
|
||||
const selection = this.tree!.getSelection();
|
||||
if ((selection.length === 1) && selection[0].command) {
|
||||
this.commandService.executeCommand(selection[0].command.id, ...(selection[0].command.arguments || []));
|
||||
}
|
||||
@@ -416,7 +416,7 @@ export class CustomTreeView extends Disposable implements ITreeView {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
this.tree.setFocus([node]);
|
||||
this.tree!.setFocus([node]);
|
||||
const actions = treeMenus.getResourceContextActions(node);
|
||||
if (!actions.length) {
|
||||
return;
|
||||
@@ -436,13 +436,13 @@ export class CustomTreeView extends Disposable implements ITreeView {
|
||||
|
||||
onHide: (wasCancelled?: boolean) => {
|
||||
if (wasCancelled) {
|
||||
this.tree.domFocus();
|
||||
this.tree!.domFocus();
|
||||
}
|
||||
},
|
||||
|
||||
getActionsContext: () => (<TreeViewItemHandleArg>{ $treeViewId: this.id, $treeItemHandle: node.handle }),
|
||||
|
||||
actionRunner: new MultipleSelectionActionRunner(() => this.tree.getSelection())
|
||||
actionRunner: new MultipleSelectionActionRunner(() => this.tree!.getSelection())
|
||||
});
|
||||
}
|
||||
|
||||
@@ -479,8 +479,8 @@ export class CustomTreeView extends Disposable implements ITreeView {
|
||||
DOM.clearNode(this.messageElement);
|
||||
}
|
||||
|
||||
private _height: number;
|
||||
private _width: number;
|
||||
private _height: number = 0;
|
||||
private _width: number = 0;
|
||||
layout(height: number, width: number) {
|
||||
if (height && width) {
|
||||
this._height = height;
|
||||
@@ -532,10 +532,11 @@ export class CustomTreeView extends Disposable implements ITreeView {
|
||||
}
|
||||
|
||||
async expand(itemOrItems: ITreeItem | ITreeItem[]): Promise<void> {
|
||||
if (this.tree) {
|
||||
const tree = this.tree;
|
||||
if (tree) {
|
||||
itemOrItems = Array.isArray(itemOrItems) ? itemOrItems : [itemOrItems];
|
||||
await Promise.all(itemOrItems.map(element => {
|
||||
return this.tree.expand(element, false);
|
||||
return tree.expand(element, false);
|
||||
}));
|
||||
}
|
||||
return Promise.resolve(undefined);
|
||||
@@ -575,18 +576,19 @@ export class CustomTreeView extends Disposable implements ITreeView {
|
||||
|
||||
private refreshing: boolean = false;
|
||||
private async doRefresh(elements: ITreeItem[]): Promise<void> {
|
||||
if (this.tree) {
|
||||
const tree = this.tree;
|
||||
if (tree) {
|
||||
this.refreshing = true;
|
||||
const parents: Set<ITreeItem> = new Set<ITreeItem>();
|
||||
elements.forEach(element => {
|
||||
if (element !== this.root) {
|
||||
const parent = this.tree.getParentElement(element);
|
||||
const parent = tree.getParentElement(element);
|
||||
parents.add(parent);
|
||||
} else {
|
||||
parents.add(element);
|
||||
}
|
||||
});
|
||||
await Promise.all(Array.from(parents.values()).map(element => this.tree.updateChildren(element, true)));
|
||||
await Promise.all(Array.from(parents.values()).map(element => tree.updateChildren(element, true)));
|
||||
this.refreshing = false;
|
||||
this.updateContentAreas();
|
||||
if (this.focused) {
|
||||
@@ -772,7 +774,7 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
|
||||
}
|
||||
|
||||
class Aligner extends Disposable {
|
||||
private _tree: WorkbenchAsyncDataTree<ITreeItem, ITreeItem, FuzzyScore>;
|
||||
private _tree: WorkbenchAsyncDataTree<ITreeItem, ITreeItem, FuzzyScore> | undefined;
|
||||
|
||||
constructor(private themeService: IWorkbenchThemeService) {
|
||||
super();
|
||||
@@ -790,11 +792,15 @@ class Aligner extends Disposable {
|
||||
return false;
|
||||
}
|
||||
|
||||
const parent: ITreeItem = this._tree.getParentElement(treeItem) || this._tree.getInput();
|
||||
if (this.hasIcon(parent)) {
|
||||
if (this._tree) {
|
||||
const parent: ITreeItem = this._tree.getParentElement(treeItem) || this._tree.getInput();
|
||||
if (this.hasIcon(parent)) {
|
||||
return false;
|
||||
}
|
||||
return !!parent.children && parent.children.every(c => c.collapsibleState === TreeItemCollapsibleState.None || !this.hasIcon(c));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return !!parent.children && parent.children.every(c => c.collapsibleState === TreeItemCollapsibleState.None || !this.hasIcon(c));
|
||||
}
|
||||
|
||||
private hasIcon(node: ITreeItem): boolean {
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
border-top: none !important; /* less clutter: do not show any border for first views in a panel */
|
||||
}
|
||||
|
||||
.monaco-panel-view .panel > .panel-header > .actions.show {
|
||||
display: initial;
|
||||
}
|
||||
|
||||
.monaco-panel-view .panel > .panel-header h3.title {
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
@@ -41,6 +41,7 @@ export interface IViewletPanelOptions extends IPanelOptions {
|
||||
actionRunner?: IActionRunner;
|
||||
id: string;
|
||||
title: string;
|
||||
showActionsAlways?: boolean;
|
||||
}
|
||||
|
||||
export abstract class ViewletPanel extends Panel implements IView {
|
||||
@@ -67,6 +68,7 @@ export abstract class ViewletPanel extends Panel implements IView {
|
||||
|
||||
protected actionRunner?: IActionRunner;
|
||||
protected toolbar: ToolBar;
|
||||
private readonly showActionsAlways: boolean = false;
|
||||
private headerContainer: HTMLElement;
|
||||
private titleContainer: HTMLElement;
|
||||
|
||||
@@ -82,6 +84,7 @@ export abstract class ViewletPanel extends Panel implements IView {
|
||||
this.id = options.id;
|
||||
this.title = options.title;
|
||||
this.actionRunner = options.actionRunner;
|
||||
this.showActionsAlways = !!options.showActionsAlways;
|
||||
this.focusedViewContextKey = FocusedViewContext.bindTo(contextKeyService);
|
||||
}
|
||||
|
||||
@@ -133,6 +136,7 @@ export abstract class ViewletPanel extends Panel implements IView {
|
||||
this.renderHeaderTitle(container, this.title);
|
||||
|
||||
const actions = append(container, $('.actions'));
|
||||
toggleClass(actions, 'show', this.showActionsAlways);
|
||||
this.toolbar = new ToolBar(actions, this.contextMenuService, {
|
||||
orientation: ActionsOrientation.HORIZONTAL,
|
||||
actionViewItemProvider: action => this.getActionViewItem(action),
|
||||
|
||||
@@ -8,9 +8,8 @@ import * as browser from 'vs/base/browser/browser';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IGalleryExtension, IExtensionIdentifier, IReportedExtension, IExtensionManagementService, ILocalExtension, IGalleryMetadata } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionTipsService, ExtensionRecommendationReason, IExtensionRecommendation } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { ExtensionType, ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { IURLHandler, IURLService } from 'vs/platform/url/common/url';
|
||||
import { ConsoleLogService, ILogService } from 'vs/platform/log/common/log';
|
||||
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
|
||||
@@ -24,7 +23,7 @@ import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common
|
||||
import { ITunnelService } from 'vs/platform/remote/common/tunnel';
|
||||
// tslint:disable-next-line: import-patterns
|
||||
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
|
||||
import { addDisposableListener, EventType } from 'vs/base/browser/dom';
|
||||
import { addDisposableListener, EventType, windowOpenNoOpener } from 'vs/base/browser/dom';
|
||||
import { IEditorService, IResourceEditor } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { pathsToEditors } from 'vs/workbench/common/editor';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
@@ -90,63 +89,6 @@ registerSingleton(IExtensionTipsService, SimpleExtensionTipsService, true);
|
||||
|
||||
//#endregion
|
||||
|
||||
export class SimpleExtensionManagementService implements IExtensionManagementService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
onInstallExtension = Event.None;
|
||||
onDidInstallExtension = Event.None;
|
||||
onUninstallExtension = Event.None;
|
||||
onDidUninstallExtension = Event.None;
|
||||
|
||||
zip(extension: ILocalExtension): Promise<URI> {
|
||||
// @ts-ignore
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
unzip(zipLocation: URI, type: ExtensionType): Promise<IExtensionIdentifier> {
|
||||
// @ts-ignore
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
install(vsix: URI): Promise<ILocalExtension> {
|
||||
// @ts-ignore
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
installFromGallery(extension: IGalleryExtension): Promise<ILocalExtension> {
|
||||
// @ts-ignore
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
uninstall(extension: ILocalExtension, force?: boolean): Promise<void> {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
reinstallFromGallery(extension: ILocalExtension): Promise<void> {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
getInstalled(type?: ExtensionType): Promise<ILocalExtension[]> {
|
||||
// @ts-ignore
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
getExtensionsReport(): Promise<IReportedExtension[]> {
|
||||
// @ts-ignore
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
updateMetadata(local: ILocalExtension, metadata: IGalleryMetadata): Promise<ILocalExtension> {
|
||||
// @ts-ignore
|
||||
return Promise.resolve(local);
|
||||
}
|
||||
}
|
||||
|
||||
registerSingleton(IExtensionManagementService, SimpleExtensionManagementService);
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Extension URL Handler
|
||||
|
||||
export const IExtensionUrlHandler = createDecorator<IExtensionUrlHandler>('inactiveExtensionUrlHandler');
|
||||
@@ -784,6 +726,8 @@ export class SimpleWindowsService implements IWindowsService {
|
||||
// This needs to be handled from browser process to prevent
|
||||
// foreground ordering issues on Windows
|
||||
openExternal(_url: string): Promise<boolean> {
|
||||
windowOpenNoOpener(_url);
|
||||
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user