mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode e1d3dd53d17fb1529a002e4d6fb066db0a0bd385 (#6460)
* Merge from vscode e1d3dd53d17fb1529a002e4d6fb066db0a0bd385 * fix servers icon * fix tests
This commit is contained in:
@@ -27,14 +27,13 @@ import { IWindowService, MenuBarVisibility, getTitleBarStyle } from 'vs/platform
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { IEditorService, IResourceEditor } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { Sizing, Direction, Grid } from 'vs/base/browser/ui/grid/grid';
|
||||
import { Sizing, Direction, Grid, SerializableGrid, ISerializableView, ISerializedGrid } from 'vs/base/browser/ui/grid/grid';
|
||||
import { WorkbenchLegacyLayout } from 'vs/workbench/browser/legacyLayout';
|
||||
import { IDimension } from 'vs/platform/layout/browser/layoutService';
|
||||
import { Part } from 'vs/workbench/browser/part';
|
||||
import { IStatusbarService } from 'vs/platform/statusbar/common/statusbar';
|
||||
import { IActivityBarService } from 'vs/workbench/services/activityBar/browser/activityBarService';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { IView } from 'vs/base/browser/ui/grid/gridview';
|
||||
|
||||
enum Settings {
|
||||
MENUBAR_VISIBLE = 'window.menuBarVisibility',
|
||||
@@ -57,6 +56,8 @@ enum Storage {
|
||||
|
||||
ZEN_MODE_ENABLED = 'workbench.zenmode.active',
|
||||
CENTERED_LAYOUT_ENABLED = 'workbench.centerededitorlayout.active',
|
||||
|
||||
GRID_LAYOUT = 'workbench.grid.layout'
|
||||
}
|
||||
|
||||
export abstract class Layout extends Disposable implements IWorkbenchLayoutService {
|
||||
@@ -89,16 +90,16 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||
|
||||
private parts: Map<string, Part> = new Map<string, Part>();
|
||||
|
||||
private workbenchGrid: Grid | WorkbenchLegacyLayout;
|
||||
private workbenchGrid: SerializableGrid<ISerializableView> | WorkbenchLegacyLayout;
|
||||
|
||||
private disposed: boolean;
|
||||
|
||||
private titleBarPartView: IView;
|
||||
private activityBarPartView: IView;
|
||||
private sideBarPartView: IView;
|
||||
private panelPartView: IView;
|
||||
private editorPartView: IView;
|
||||
private statusBarPartView: IView;
|
||||
private titleBarPartView: ISerializableView;
|
||||
private activityBarPartView: ISerializableView;
|
||||
private sideBarPartView: ISerializableView;
|
||||
private panelPartView: ISerializableView;
|
||||
private editorPartView: ISerializableView;
|
||||
private statusBarPartView: ISerializableView;
|
||||
|
||||
private environmentService: IWorkbenchEnvironmentService;
|
||||
private configurationService: IConfigurationService;
|
||||
@@ -144,8 +145,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||
hidden: false,
|
||||
sizeBeforeMaximize: 0,
|
||||
position: Position.BOTTOM,
|
||||
height: 350,
|
||||
width: 350,
|
||||
panelToRestore: undefined as string | undefined
|
||||
},
|
||||
|
||||
@@ -706,7 +705,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||
|
||||
if (this.configurationService.getValue('workbench.useExperimentalGridLayout')) {
|
||||
|
||||
// Create view wrappers for all parts
|
||||
// View references for all parts
|
||||
this.titleBarPartView = titleBar;
|
||||
this.sideBarPartView = sideBar;
|
||||
this.activityBarPartView = activityBar;
|
||||
@@ -714,9 +713,63 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||
this.panelPartView = panelPart;
|
||||
this.statusBarPartView = statusBar;
|
||||
|
||||
this.workbenchGrid = new Grid(this.editorPartView, { proportionalLayout: false });
|
||||
let workbenchGrid: SerializableGrid<ISerializableView> | undefined;
|
||||
|
||||
this.container.prepend(this.workbenchGrid.element);
|
||||
const savedGrid = this.storageService.get(Storage.GRID_LAYOUT, StorageScope.GLOBAL, undefined);
|
||||
if (savedGrid) {
|
||||
const parsedGrid: ISerializedGrid = JSON.parse(savedGrid);
|
||||
|
||||
const fromJSON = (serializedPart: { type: Parts } | null) => {
|
||||
if (serializedPart && serializedPart.type) {
|
||||
switch (serializedPart.type) {
|
||||
case Parts.ACTIVITYBAR_PART:
|
||||
return this.activityBarPartView;
|
||||
case Parts.TITLEBAR_PART:
|
||||
return this.titleBarPartView;
|
||||
case Parts.EDITOR_PART:
|
||||
return this.editorPartView;
|
||||
case Parts.PANEL_PART:
|
||||
return this.panelPartView;
|
||||
case Parts.SIDEBAR_PART:
|
||||
return this.sideBarPartView;
|
||||
case Parts.STATUSBAR_PART:
|
||||
return this.statusBarPartView;
|
||||
default:
|
||||
return this.editorPartView;
|
||||
}
|
||||
} else {
|
||||
return this.editorPartView;
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
workbenchGrid = SerializableGrid.deserialize(parsedGrid, { fromJSON }, { proportionalLayout: false });
|
||||
|
||||
// Set some layout state
|
||||
this.state.sideBar.position = Position.LEFT;
|
||||
for (let view of workbenchGrid.getNeighborViews(this.sideBarPartView, Direction.Right)) {
|
||||
if (view === this.activityBarPartView) {
|
||||
this.state.sideBar.position = Position.RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
this.state.panel.position = Position.BOTTOM;
|
||||
for (let view of workbenchGrid.getNeighborViews(this.panelPartView, Direction.Left)) {
|
||||
if (view === this.editorPartView) {
|
||||
this.state.panel.position = Position.RIGHT;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
if (!workbenchGrid) {
|
||||
workbenchGrid = new SerializableGrid(this.editorPartView, { proportionalLayout: false });
|
||||
}
|
||||
|
||||
this.container.prepend(workbenchGrid.element);
|
||||
this.workbenchGrid = workbenchGrid;
|
||||
|
||||
this._register((this.sideBarPartView as SidebarPart).onDidVisibilityChange((visible) => {
|
||||
this.setSideBarHidden(!visible, true);
|
||||
@@ -725,6 +778,17 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||
this._register((this.panelPartView as PanelPart).onDidVisibilityChange((visible) => {
|
||||
this.setPanelHidden(!visible, true);
|
||||
}));
|
||||
|
||||
this._register(this.lifecycleService.onBeforeShutdown(beforeShutdownEvent => {
|
||||
beforeShutdownEvent.veto(new Promise((resolve) => {
|
||||
const grid = this.workbenchGrid as SerializableGrid<ISerializableView>;
|
||||
const serializedGrid = grid.serialize();
|
||||
|
||||
this.storageService.store(Storage.GRID_LAYOUT, JSON.stringify(serializedGrid), StorageScope.GLOBAL);
|
||||
|
||||
resolve();
|
||||
}));
|
||||
}));
|
||||
} else {
|
||||
this.workbenchGrid = instantiationService.createInstance(
|
||||
WorkbenchLegacyLayout,
|
||||
@@ -797,7 +861,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||
}
|
||||
|
||||
if (!panelInGrid) {
|
||||
this.workbenchGrid.addView(this.panelPartView, this.getPanelDimension(this.state.panel.position) !== undefined ? this.getPanelDimension(this.state.panel.position) : Sizing.Split, this.editorPartView, this.state.panel.position === Position.BOTTOM ? Direction.Down : Direction.Right);
|
||||
this.workbenchGrid.addView(this.panelPartView, Sizing.Split, this.editorPartView, this.state.panel.position === Position.BOTTOM ? Direction.Down : Direction.Right);
|
||||
panelInGrid = true;
|
||||
}
|
||||
|
||||
@@ -852,10 +916,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||
}
|
||||
}
|
||||
|
||||
private getPanelDimension(position: Position): number {
|
||||
return position === Position.BOTTOM ? this.state.panel.height : this.state.panel.width;
|
||||
}
|
||||
|
||||
isEditorLayoutCentered(): boolean {
|
||||
return this.state.editor.centered;
|
||||
}
|
||||
@@ -1148,12 +1208,9 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||
|
||||
setPanelPosition(position: Position): void {
|
||||
const panelPart = this.getPart(Parts.PANEL_PART);
|
||||
const wasHidden = this.state.panel.hidden;
|
||||
|
||||
if (this.state.panel.hidden) {
|
||||
this.setPanelHidden(false, true /* Skip Layout */);
|
||||
} else {
|
||||
this.savePanelDimension();
|
||||
}
|
||||
|
||||
const newPositionValue = (position === Position.BOTTOM) ? 'bottom' : 'right';
|
||||
@@ -1179,10 +1236,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||
|
||||
// Layout
|
||||
if (this.workbenchGrid instanceof Grid) {
|
||||
if (!wasHidden) {
|
||||
this.savePanelDimension();
|
||||
}
|
||||
|
||||
this.workbenchGrid.removeView(this.panelPartView);
|
||||
this.layout();
|
||||
} else {
|
||||
@@ -1192,18 +1245,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||
this._onPanelPositionChange.fire(positionToString(this.state.panel.position));
|
||||
}
|
||||
|
||||
private savePanelDimension(): void {
|
||||
if (!(this.workbenchGrid instanceof Grid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.state.panel.position === Position.BOTTOM) {
|
||||
this.state.panel.height = this.workbenchGrid.getViewSize(this.panelPartView).height;
|
||||
} else {
|
||||
this.state.panel.width = this.workbenchGrid.getViewSize(this.panelPartView).width;
|
||||
}
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
super.dispose();
|
||||
|
||||
|
||||
@@ -8,9 +8,6 @@ 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';
|
||||
// tslint:disable-next-line: import-patterns no-standalone-editor
|
||||
import { IDownloadService } from 'vs/platform/download/common/download';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
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';
|
||||
@@ -33,7 +30,7 @@ import { IEditorService, IResourceEditor } from 'vs/workbench/services/editor/co
|
||||
import { pathsToEditors } from 'vs/workbench/common/editor';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ParsedArgs } from 'vs/platform/environment/common/environment';
|
||||
import { ParsedArgs, IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IProcessEnvironment } from 'vs/base/common/platform';
|
||||
import { toStoreData, restoreRecentlyOpened } from 'vs/platform/history/common/historyStorage';
|
||||
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
|
||||
@@ -41,22 +38,6 @@ import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteA
|
||||
import { IExperimentService, IExperiment, ExperimentActionType, ExperimentState } from 'vs/workbench/contrib/experiments/common/experimentService';
|
||||
import { ExtensionHostDebugChannelClient, ExtensionHostDebugBroadcastChannel } from 'vs/platform/debug/common/extensionHostDebugIpc';
|
||||
|
||||
//#region Download
|
||||
|
||||
export class SimpleDownloadService implements IDownloadService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
download(uri: URI, to?: string, cancellationToken?: CancellationToken): Promise<string> {
|
||||
// @ts-ignore
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
registerSingleton(IDownloadService, SimpleDownloadService, true);
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Extension Tips
|
||||
|
||||
export class SimpleExtensionTipsService implements IExtensionTipsService {
|
||||
@@ -583,7 +564,9 @@ registerSingleton(IWindowService, SimpleWindowService);
|
||||
export class SimpleExtensionHostDebugService extends ExtensionHostDebugChannelClient {
|
||||
|
||||
constructor(
|
||||
@IRemoteAgentService remoteAgentService: IRemoteAgentService
|
||||
@IRemoteAgentService remoteAgentService: IRemoteAgentService,
|
||||
//@IWindowService windowService: IWindowService,
|
||||
@IEnvironmentService environmentService: IEnvironmentService
|
||||
) {
|
||||
const connection = remoteAgentService.getConnection();
|
||||
|
||||
@@ -592,6 +575,19 @@ export class SimpleExtensionHostDebugService extends ExtensionHostDebugChannelCl
|
||||
}
|
||||
|
||||
super(connection.getChannel(ExtensionHostDebugBroadcastChannel.ChannelName));
|
||||
|
||||
this._register(this.onReload(event => {
|
||||
if (environmentService.isExtensionDevelopment && environmentService.debugExtensionHost.debugId === event.sessionId) {
|
||||
//windowService.reloadWindow();
|
||||
window.location.reload();
|
||||
}
|
||||
}));
|
||||
this._register(this.onClose(event => {
|
||||
if (environmentService.isExtensionDevelopment && environmentService.debugExtensionHost.debugId === event.sessionId) {
|
||||
//this._windowService.closeWindow();
|
||||
window.close();
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
registerSingleton(IExtensionHostDebugService, SimpleExtensionHostDebugService);
|
||||
|
||||
@@ -237,7 +237,7 @@ import { isMacintosh, isWindows, isLinux, isWeb } from 'vs/base/common/platform'
|
||||
'workbench.useExperimentalGridLayout': {
|
||||
'type': 'boolean',
|
||||
'description': nls.localize('workbench.useExperimentalGridLayout', "Enables the grid layout for the workbench. This setting may enable additional layout options for workbench components."),
|
||||
'default': false,
|
||||
'default': true,
|
||||
'scope': ConfigurationScope.APPLICATION
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user