mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-29 08:10:29 -04:00
Vscode merge (#4582)
* Merge from vscode 37cb23d3dd4f9433d56d4ba5ea3203580719a0bd * fix issues with merges * bump node version in azpipe * replace license headers * remove duplicate launch task * fix build errors * fix build errors * fix tslint issues * working through package and linux build issues * more work * wip * fix packaged builds * working through linux build errors * wip * wip * wip * fix mac and linux file limits * iterate linux pipeline * disable editor typing * revert series to parallel * remove optimize vscode from linux * fix linting issues * revert testing change * add work round for new node * readd packaging for extensions * fix issue with angular not resolving decorator dependencies
This commit is contained in:
@@ -0,0 +1,126 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { join } from 'vs/base/common/path';
|
||||
import { onDidChangeFullscreen, isFullscreen } from 'vs/base/browser/browser';
|
||||
import { getTotalHeight, getTotalWidth } from 'vs/base/browser/dom';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IBroadcastService } from 'vs/workbench/services/broadcast/electron-browser/broadcastService';
|
||||
import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { ColorIdentifier, editorBackground, foreground } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { getThemeTypeSelector, IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { DEFAULT_EDITOR_MIN_DIMENSIONS } from 'vs/workbench/browser/parts/editor/editor';
|
||||
import { Extensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions';
|
||||
import * as themes from 'vs/workbench/common/theme';
|
||||
import { IWorkbenchLayoutService, Parts, Position } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
class PartsSplash {
|
||||
|
||||
private static readonly _splashElementId = 'monaco-parts-splash';
|
||||
|
||||
private readonly _disposables: IDisposable[] = [];
|
||||
|
||||
private _didChangeTitleBarStyle: boolean;
|
||||
private _lastBaseTheme: string;
|
||||
private _lastBackground?: string;
|
||||
|
||||
constructor(
|
||||
@IThemeService private readonly _themeService: IThemeService,
|
||||
@IWorkbenchLayoutService private readonly _layoutService: IWorkbenchLayoutService,
|
||||
@IFileService private readonly _fileService: IFileService,
|
||||
@IEnvironmentService private readonly _envService: IEnvironmentService,
|
||||
@IBroadcastService private readonly _broadcastService: IBroadcastService,
|
||||
@ILifecycleService lifecycleService: ILifecycleService,
|
||||
@IEditorGroupsService editorGroupsService: IEditorGroupsService,
|
||||
@IConfigurationService configService: IConfigurationService,
|
||||
) {
|
||||
lifecycleService.when(LifecyclePhase.Restored).then(_ => this._removePartsSplash());
|
||||
Event.debounce(Event.any<any>(
|
||||
onDidChangeFullscreen,
|
||||
editorGroupsService.onDidLayout
|
||||
), () => { }, 800)(this._savePartsSplash, this, this._disposables);
|
||||
|
||||
configService.onDidChangeConfiguration(e => {
|
||||
this._didChangeTitleBarStyle = e.affectsConfiguration('window.titleBarStyle');
|
||||
}, this, this._disposables);
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
dispose(this._disposables);
|
||||
}
|
||||
|
||||
private _savePartsSplash() {
|
||||
const baseTheme = getThemeTypeSelector(this._themeService.getTheme().type);
|
||||
const colorInfo = {
|
||||
foreground: this._getThemeColor(foreground),
|
||||
editorBackground: this._getThemeColor(editorBackground),
|
||||
titleBarBackground: this._getThemeColor(themes.TITLE_BAR_ACTIVE_BACKGROUND),
|
||||
activityBarBackground: this._getThemeColor(themes.ACTIVITY_BAR_BACKGROUND),
|
||||
sideBarBackground: this._getThemeColor(themes.SIDE_BAR_BACKGROUND),
|
||||
statusBarBackground: this._getThemeColor(themes.STATUS_BAR_BACKGROUND),
|
||||
statusBarNoFolderBackground: this._getThemeColor(themes.STATUS_BAR_NO_FOLDER_BACKGROUND),
|
||||
};
|
||||
const layoutInfo = !this._shouldSaveLayoutInfo() ? undefined : {
|
||||
sideBarSide: this._layoutService.getSideBarPosition() === Position.RIGHT ? 'right' : 'left',
|
||||
editorPartMinWidth: DEFAULT_EDITOR_MIN_DIMENSIONS.width,
|
||||
titleBarHeight: getTotalHeight(this._layoutService.getContainer(Parts.TITLEBAR_PART)),
|
||||
activityBarWidth: getTotalWidth(this._layoutService.getContainer(Parts.ACTIVITYBAR_PART)),
|
||||
sideBarWidth: getTotalWidth(this._layoutService.getContainer(Parts.SIDEBAR_PART)),
|
||||
statusBarHeight: getTotalHeight(this._layoutService.getContainer(Parts.STATUSBAR_PART)),
|
||||
};
|
||||
this._fileService.updateContent(
|
||||
URI.file(join(this._envService.userDataPath, 'rapid_render.json')),
|
||||
JSON.stringify({
|
||||
id: PartsSplash._splashElementId,
|
||||
colorInfo,
|
||||
layoutInfo,
|
||||
baseTheme
|
||||
}),
|
||||
{ encoding: 'utf8' }
|
||||
);
|
||||
|
||||
if (baseTheme !== this._lastBaseTheme || colorInfo.editorBackground !== this._lastBackground) {
|
||||
// notify the main window on background color changes: the main window sets the background color to new windows
|
||||
this._lastBaseTheme = baseTheme;
|
||||
this._lastBackground = colorInfo.editorBackground;
|
||||
|
||||
// the color needs to be in hex
|
||||
const backgroundColor = this._themeService.getTheme().getColor(editorBackground) || themes.WORKBENCH_BACKGROUND(this._themeService.getTheme());
|
||||
this._broadcastService.broadcast({ channel: 'vscode:changeColorTheme', payload: JSON.stringify({ baseTheme, background: Color.Format.CSS.formatHex(backgroundColor) }) });
|
||||
}
|
||||
}
|
||||
|
||||
private _getThemeColor(id: ColorIdentifier): string | undefined {
|
||||
const theme = this._themeService.getTheme();
|
||||
const color = theme.getColor(id);
|
||||
return color ? color.toString() : undefined;
|
||||
}
|
||||
|
||||
private _shouldSaveLayoutInfo(): boolean {
|
||||
return !isFullscreen() && !this._envService.isExtensionDevelopment && !this._didChangeTitleBarStyle;
|
||||
}
|
||||
|
||||
private _removePartsSplash(): void {
|
||||
let element = document.getElementById(PartsSplash._splashElementId);
|
||||
if (element) {
|
||||
element.style.display = 'none';
|
||||
}
|
||||
// remove initial colors
|
||||
let defaultStyles = document.head.getElementsByClassName('initialShellColors');
|
||||
if (defaultStyles.length) {
|
||||
document.head.removeChild(defaultStyles[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Registry.as<IWorkbenchContributionsRegistry>(Extensions.Workbench).registerWorkbenchContribution(PartsSplash, LifecyclePhase.Starting);
|
||||
Reference in New Issue
Block a user