mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-26 01:25:38 -05:00
Merge branch 'ads-master-vscode-2020-03-11T04-19-20'
This commit is contained in:
@@ -20,13 +20,13 @@ import { localize } from 'vs/nls';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { find, firstIndex } from 'vs/base/common/arrays';
|
||||
import { IThemable } from 'vs/base/common/styler';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
|
||||
|
||||
export enum MessageLevel {
|
||||
Error = 0,
|
||||
@@ -151,7 +151,7 @@ export abstract class Modal extends Disposable implements IThemable {
|
||||
private _title: string,
|
||||
private _name: string,
|
||||
private readonly _telemetryService: IAdsTelemetryService,
|
||||
protected readonly layoutService: IWorkbenchLayoutService,
|
||||
protected readonly layoutService: ILayoutService,
|
||||
protected readonly _clipboardService: IClipboardService,
|
||||
protected readonly _themeService: IThemeService,
|
||||
protected readonly logService: ILogService,
|
||||
@@ -181,7 +181,7 @@ export abstract class Modal extends Disposable implements IThemable {
|
||||
}
|
||||
|
||||
this._bodyContainer = DOM.$(`.${builderClass}`, { role: 'dialog', 'aria-label': this._title });
|
||||
const top = this.layoutService.getTitleBarOffset();
|
||||
const top = this.layoutService.offset?.top ?? 0;
|
||||
this._bodyContainer.style.top = `${top}px`;
|
||||
this._modalDialog = DOM.append(this._bodyContainer, DOM.$('.modal-dialog'));
|
||||
this._modalContent = DOM.append(this._modalDialog, DOM.$('.modal-content'));
|
||||
|
||||
@@ -27,9 +27,8 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { append, $ } from 'vs/base/browser/dom';
|
||||
import { IThemeService, ITheme } from 'vs/platform/theme/common/themeService';
|
||||
import { IThemeService, IColorTheme } from 'vs/platform/theme/common/themeService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer';
|
||||
@@ -38,6 +37,7 @@ import { IViewDescriptorService } from 'vs/workbench/common/views';
|
||||
import { ServiceOptionType } from 'sql/platform/connection/common/interfaces';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
|
||||
|
||||
export class CategoryView extends ViewPane {
|
||||
|
||||
@@ -98,7 +98,7 @@ export class OptionsDialog extends Modal {
|
||||
title: string,
|
||||
name: string,
|
||||
options: IOptionsDialogOptions,
|
||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
|
||||
@ILayoutService layoutService: ILayoutService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IContextViewService private _contextViewService: IContextViewService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@@ -123,8 +123,8 @@ export class OptionsDialog extends Modal {
|
||||
// Theme styler
|
||||
attachButtonStyler(okButton, this._themeService);
|
||||
attachButtonStyler(closeButton, this._themeService);
|
||||
this._register(this._themeService.onThemeChange(e => this.updateTheme(e)));
|
||||
this.updateTheme(this._themeService.getTheme());
|
||||
this._register(this._themeService.onDidColorThemeChange(e => this.updateTheme(e)));
|
||||
this.updateTheme(this._themeService.getColorTheme());
|
||||
}
|
||||
|
||||
protected renderBody(container: HTMLElement) {
|
||||
@@ -142,7 +142,7 @@ export class OptionsDialog extends Modal {
|
||||
}
|
||||
|
||||
// Update theming that is specific to options dialog flyout body
|
||||
private updateTheme(theme: ITheme): void {
|
||||
private updateTheme(theme: IColorTheme): void {
|
||||
let borderColor = theme.getColor(contrastBorder);
|
||||
let border = borderColor ? borderColor.toString() : null;
|
||||
if (this._dividerBuilder) {
|
||||
@@ -239,7 +239,7 @@ export class OptionsDialog extends Modal {
|
||||
this.fillInOptions(bodyContainer, serviceOptions);
|
||||
|
||||
let viewSize = this._optionCategoryPadding + serviceOptions.length * this._optionRowSize;
|
||||
let categoryView = this._instantiationService.createInstance(CategoryView, bodyContainer, viewSize, { title: category, ariaHeaderLabel: category, id: category });
|
||||
let categoryView = this._instantiationService.createInstance(CategoryView, bodyContainer, viewSize, { title: category, id: category });
|
||||
this.splitview.addView(categoryView, viewSize);
|
||||
categoryView.render();
|
||||
attachPanelStyler(categoryView, this._themeService);
|
||||
|
||||
@@ -11,13 +11,14 @@ import {
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
import * as colors from 'vs/platform/theme/common/colorRegistry';
|
||||
import { IColorTheme, IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
|
||||
import { ComponentWithIconBase } from 'sql/workbench/browser/modelComponents/componentWithIconBase';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { KeyCode } from 'vs/base/common/keyCodes';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { IComponent, IComponentDescriptor, IModelStore, ComponentEventType } from 'sql/platform/dashboard/browser/interfaces';
|
||||
import { IColorTheme } from 'vs/platform/theme/common/themeService';
|
||||
|
||||
export interface ActionDescriptor {
|
||||
label: string;
|
||||
|
||||
@@ -32,7 +32,7 @@ export default class CheckBoxComponent extends ComponentBase implements ICompone
|
||||
constructor(
|
||||
@Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef,
|
||||
@Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService,
|
||||
@Inject(forwardRef(() => ElementRef)) el: ElementRef, ) {
|
||||
@Inject(forwardRef(() => ElementRef)) el: ElementRef,) {
|
||||
super(changeRef, el);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import { ModelComponentWrapper } from 'sql/workbench/browser/modelComponents/mod
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import * as nls from 'vs/nls';
|
||||
import { EventType, addDisposableListener } from 'vs/base/browser/dom';
|
||||
import { IKeyboardEvent, StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { endsWith } from 'vs/base/common/strings';
|
||||
import { firstIndex } from 'vs/base/common/arrays';
|
||||
import { IComponentDescriptor, IComponent, IModelStore, IComponentEventArgs, ComponentEventType } from 'sql/platform/dashboard/browser/interfaces';
|
||||
@@ -291,7 +291,7 @@ export abstract class ComponentBase extends Disposable implements IComponent, On
|
||||
(<HTMLElement>this._el.nativeElement).focus();
|
||||
}
|
||||
|
||||
protected onkeydown(domNode: HTMLElement, listener: (e: IKeyboardEvent) => void): void {
|
||||
protected onkeydown(domNode: HTMLElement, listener: (e: StandardKeyboardEvent) => void): void {
|
||||
this._register(addDisposableListener(domNode, EventType.KEY_DOWN, (e: KeyboardEvent) => listener(new StandardKeyboardEvent(e))));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ export abstract class ComponentWithIconBase extends ComponentBase {
|
||||
protected _iconPath: IUserFriendlyIcon;
|
||||
constructor(
|
||||
changeRef: ChangeDetectorRef,
|
||||
el: ElementRef, ) {
|
||||
el: ElementRef,) {
|
||||
super(changeRef, el);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ export default class EditorComponent extends ComponentBase implements IComponent
|
||||
this._editor.create(this._el.nativeElement);
|
||||
this._editor.setVisible(true);
|
||||
let uri = this.createUri();
|
||||
this._editorInput = this.editorService.createInput({ forceUntitled: true, resource: uri, mode: 'plaintext' }) as UntitledTextEditorInput;
|
||||
this._editorInput = this.editorService.createEditorInput({ forceUntitled: true, resource: uri, mode: 'plaintext' }) as UntitledTextEditorInput;
|
||||
await this._editor.setInput(this._editorInput, undefined);
|
||||
const model = await this._editorInput.resolve();
|
||||
this._editorModel = model.textEditorModel;
|
||||
|
||||
@@ -19,7 +19,7 @@ import { memoize } from 'vs/base/common/decorators';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { LayoutRequestParams } from 'sql/workbench/services/dialog/browser/dialogContainer.component';
|
||||
import { IThemeService, ITheme } from 'vs/platform/theme/common/themeService';
|
||||
import { IThemeService, IColorTheme } from 'vs/platform/theme/common/themeService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IBootstrapParams } from 'sql/workbench/services/bootstrap/common/bootstrapParams';
|
||||
import { IComponentDescriptor, IModelStore, IComponent } from 'sql/platform/dashboard/browser/interfaces';
|
||||
@@ -75,11 +75,11 @@ export class ModelComponentWrapper extends AngularDisposable implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this._register(this.themeService.onThemeChange(event => this.updateTheme(event)));
|
||||
this._register(this.themeService.onDidColorThemeChange(event => this.updateTheme(event)));
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.updateTheme(this.themeService.getTheme());
|
||||
this.updateTheme(this.themeService.getColorTheme());
|
||||
if (this.componentHost) {
|
||||
this.loadComponent();
|
||||
}
|
||||
@@ -148,7 +148,7 @@ export class ModelComponentWrapper extends AngularDisposable implements OnInit {
|
||||
el.style.position = 'relative';
|
||||
}
|
||||
|
||||
private updateTheme(theme: ITheme): void {
|
||||
private updateTheme(theme: IColorTheme): void {
|
||||
// TODO handle theming appropriately
|
||||
let el = <HTMLElement>this._ref.nativeElement;
|
||||
let backgroundColor = theme.getColor(colors.editorBackground, true);
|
||||
|
||||
@@ -126,7 +126,7 @@ export class QueryTextEditor extends BaseTextEditor {
|
||||
return editorWidget.getScrollHeight();
|
||||
}
|
||||
|
||||
public setHeightToScrollHeight(configChanged?: boolean, isEditorCollapsed?: boolean, ) {
|
||||
public setHeightToScrollHeight(configChanged?: boolean, isEditorCollapsed?: boolean,) {
|
||||
let editorWidget = this.getControl() as ICodeEditor;
|
||||
let layoutInfo = editorWidget.getLayoutInfo();
|
||||
if (!this._scrollbarHeight) {
|
||||
|
||||
@@ -147,9 +147,9 @@ export default class TableComponent extends ComponentBase implements IComponent,
|
||||
});
|
||||
}));
|
||||
|
||||
this._table.grid.onKeyDown.subscribe((e: KeyboardEvent) => {
|
||||
this._table.grid.onKeyDown.subscribe((e: DOMEvent) => {
|
||||
if (this.moveFocusOutWithTab) {
|
||||
let event = new StandardKeyboardEvent(e);
|
||||
let event = new StandardKeyboardEvent(e as KeyboardEvent);
|
||||
if (event.equals(KeyMod.Shift | KeyCode.Tab)) {
|
||||
e.stopImmediatePropagation();
|
||||
(<HTMLElement>(<HTMLElement>this._inputContainer.nativeElement).previousElementSibling).focus();
|
||||
|
||||
@@ -138,7 +138,7 @@ export class TreeComponentRenderer extends Disposable implements IRenderer {
|
||||
* Render a element, given an object bag returned by the template
|
||||
*/
|
||||
public renderElement(tree: ITree, element: ITreeComponentItem, templateId: string, templateData: TreeDataTemplate): void {
|
||||
const icon = this.themeService.getTheme().type === LIGHT ? element.icon : element.iconDark;
|
||||
const icon = this.themeService.getColorTheme().type === LIGHT ? element.icon : element.iconDark;
|
||||
const iconUri = icon ? URI.revive(icon) : null;
|
||||
templateData.icon.style.backgroundImage = iconUri ? `url('${iconUri.toString(true)}')` : '';
|
||||
templateData.icon.style.backgroundRepeat = 'no-repeat';
|
||||
|
||||
@@ -20,8 +20,8 @@ const languageAssociationRegistry = Registry.as<ILanguageAssociationRegistry>(La
|
||||
*/
|
||||
export async function setMode(accessor: ServicesAccessor, modeSupport: IModeSupport, activeEditor: IEditorInput, language: string): Promise<void> {
|
||||
const editorService = accessor.get(IEditorService);
|
||||
const activeWidget = getCodeEditor(editorService.activeTextEditorWidget);
|
||||
const activeControl = editorService.activeControl;
|
||||
const activeWidget = getCodeEditor(editorService.activeTextEditorControl);
|
||||
const activeControl = editorService.activeEditorPane;
|
||||
const textModel = activeWidget.getModel();
|
||||
const oldLanguage = textModel.getLanguageIdentifier().language;
|
||||
if (language !== oldLanguage) {
|
||||
|
||||
@@ -27,7 +27,7 @@ import { URI } from 'vs/base/common/uri';
|
||||
import { dirname, basename } from 'vs/base/common/resources';
|
||||
import { LIGHT, FileThemeIcon, FolderThemeIcon, registerThemingParticipant, IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { FileKind } from 'vs/platform/files/common/files';
|
||||
import { WorkbenchAsyncDataTree, TreeResourceNavigator } from 'vs/platform/list/browser/listService';
|
||||
import { WorkbenchAsyncDataTree, ResourceNavigator } from 'vs/platform/list/browser/listService';
|
||||
import { localize } from 'vs/nls';
|
||||
import { timeout } from 'vs/base/common/async';
|
||||
import { editorFindMatchHighlight, editorFindMatchHighlightBorder, textLinkForeground, textCodeBlockBackground, focusBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||
@@ -52,7 +52,7 @@ import { firstIndex } from 'vs/base/common/arrays';
|
||||
import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
|
||||
export class CustomTreeViewPanel extends ViewPane {
|
||||
export class CustomTreeViewPane extends ViewPane {
|
||||
|
||||
private treeView: ITreeView;
|
||||
|
||||
@@ -69,13 +69,14 @@ export class CustomTreeViewPanel extends ViewPane {
|
||||
@IThemeService protected themeService: IThemeService,
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
) {
|
||||
super({ ...(options as IViewPaneOptions), ariaHeaderLabel: options.title }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
|
||||
super({ ...(options as IViewPaneOptions) }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
|
||||
const { treeView } = (<ITreeViewDescriptor>Registry.as<IViewsRegistry>(Extensions.ViewsRegistry).getView(options.id));
|
||||
this.treeView = treeView as ITreeView;
|
||||
this._register(this.treeView.onDidChangeActions(() => this.updateActions(), this));
|
||||
this._register(this.treeView.onDidChangeTitle((newTitle) => this.updateTitle(newTitle)));
|
||||
this._register(toDisposable(() => this.treeView.setVisibility(false)));
|
||||
this._register(this.onDidChangeBodyVisibility(() => this.updateTreeVisibility()));
|
||||
this._register(this.treeView.onDidChangeWelcomeState(() => this._onDidChangeViewWelcomeState.fire()));
|
||||
this.updateTreeVisibility();
|
||||
}
|
||||
|
||||
@@ -90,18 +91,14 @@ export class CustomTreeViewPanel extends ViewPane {
|
||||
}
|
||||
}
|
||||
|
||||
shouldShowWelcome(): boolean {
|
||||
return (this.treeView.dataProvider === undefined) && (this.treeView.message === undefined);
|
||||
}
|
||||
|
||||
layoutBody(height: number, width: number): void {
|
||||
this.treeView.layout(height, width);
|
||||
}
|
||||
|
||||
getActions(): IAction[] {
|
||||
return [...this.treeView.getPrimaryActions()];
|
||||
}
|
||||
|
||||
getSecondaryActions(): IAction[] {
|
||||
return [...this.treeView.getSecondaryActions()];
|
||||
}
|
||||
|
||||
getActionViewItem(action: IAction): IActionViewItem | undefined {
|
||||
return action instanceof MenuItemAction ? new ContextAwareMenuEntryActionViewItem(action, this.keybindingService, this.notificationService, this.contextMenuService) : undefined;
|
||||
}
|
||||
@@ -209,6 +206,9 @@ export class CustomTreeView extends Disposable implements ITreeView {
|
||||
private readonly _onDidChangeActions: Emitter<void> = this._register(new Emitter<void>());
|
||||
readonly onDidChangeActions: Event<void> = this._onDidChangeActions.event;
|
||||
|
||||
private readonly _onDidChangeWelcomeState: Emitter<void> = this._register(new Emitter<void>());
|
||||
readonly onDidChangeWelcomeState: Event<void> = this._onDidChangeWelcomeState.event;
|
||||
|
||||
private readonly _onDidChangeTitle: Emitter<string> = this._register(new Emitter<string>());
|
||||
readonly onDidChangeTitle: Event<string> = this._onDidChangeTitle.event;
|
||||
|
||||
@@ -232,7 +232,7 @@ export class CustomTreeView extends Disposable implements ITreeView {
|
||||
this.menus = this._register(instantiationService.createInstance(TitleMenus, this.id));
|
||||
this._register(this.menus.onDidChangeTitle(() => this._onDidChangeActions.fire()));
|
||||
this._register(this.themeService.onDidFileIconThemeChange(() => this.doRefresh([this.root]) /** soft refresh **/));
|
||||
this._register(this.themeService.onThemeChange(() => this.doRefresh([this.root]) /** soft refresh **/));
|
||||
this._register(this.themeService.onDidColorThemeChange(() => this.doRefresh([this.root]) /** soft refresh **/));
|
||||
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
||||
if (e.affectsConfiguration('explorer.decorations')) {
|
||||
this.doRefresh([this.root]).catch(onUnexpectedError); /** soft refresh **/
|
||||
@@ -277,6 +277,8 @@ export class CustomTreeView extends Disposable implements ITreeView {
|
||||
this._dataProvider = null;
|
||||
this.updateMessage();
|
||||
}
|
||||
|
||||
this._onDidChangeWelcomeState.fire();
|
||||
}
|
||||
|
||||
private _message: string | undefined;
|
||||
@@ -287,6 +289,7 @@ export class CustomTreeView extends Disposable implements ITreeView {
|
||||
set message(message: string | undefined) {
|
||||
this._message = message;
|
||||
this.updateMessage();
|
||||
this._onDidChangeWelcomeState.fire();
|
||||
}
|
||||
|
||||
get title(): string {
|
||||
@@ -448,7 +451,7 @@ export class CustomTreeView extends Disposable implements ITreeView {
|
||||
}));
|
||||
this.tree.setInput(this.root).then(() => this.updateContentAreas());
|
||||
|
||||
const customTreeNavigator = new TreeResourceNavigator(this.tree);
|
||||
const customTreeNavigator = ResourceNavigator.createTreeResourceNavigator(this.tree, { openOnFocus: false, openOnSelection: false });
|
||||
this._register(customTreeNavigator);
|
||||
this._register(customTreeNavigator.onDidOpenResource(e => {
|
||||
if (!e.browserEvent) {
|
||||
@@ -809,7 +812,7 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
|
||||
const treeItemLabel: ITreeItemLabel | undefined = node.label ? node.label : resource ? { label: basename(resource) } : undefined;
|
||||
const description = isString(node.description) ? node.description : resource && node.description === true ? this.labelService.getUriLabel(dirname(resource), { relative: true }) : undefined;
|
||||
const label = treeItemLabel ? treeItemLabel.label : undefined;
|
||||
const icon = this.themeService.getTheme().type === LIGHT ? node.icon : node.iconDark;
|
||||
const icon = this.themeService.getColorTheme().type === LIGHT ? node.icon : node.iconDark;
|
||||
const iconUrl = icon ? URI.revive(icon) : null;
|
||||
const title = node.tooltip ? node.tooltip : resource ? undefined : label;
|
||||
const sqlIcon = node.sqlIcon;
|
||||
@@ -892,7 +895,7 @@ class Aligner extends Disposable {
|
||||
}
|
||||
|
||||
private hasIcon(node: ITreeItem): boolean {
|
||||
const icon = this.themeService.getTheme().type === LIGHT ? node.icon : node.iconDark;
|
||||
const icon = this.themeService.getColorTheme().type === LIGHT ? node.icon : node.iconDark;
|
||||
if (icon) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user