mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-31 17:20:28 -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:
74
src/vs/workbench/contrib/watermark/browser/watermark.css
Normal file
74
src/vs/workbench/contrib/watermark/browser/watermark.css
Normal file
@@ -0,0 +1,74 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.monaco-workbench .part.editor.has-watermark > .content.empty .editor-group-container > .editor-group-letterpress {
|
||||
background-position-y: calc(50% - 100px);
|
||||
}
|
||||
|
||||
.monaco-workbench .part.editor.max-height-478px > .content.empty .editor-group-container > .editor-group-letterpress {
|
||||
background-position-y: 50%;
|
||||
}
|
||||
|
||||
.monaco-workbench .part.editor > .content > .watermark {
|
||||
display: none; /* only visible when no editors are opened */
|
||||
}
|
||||
|
||||
.monaco-workbench .part.editor.has-watermark > .content.empty > .watermark {
|
||||
display: block;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
top: calc(50% + 55px);
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.monaco-workbench .part.editor > .content.empty > .watermark > .watermark-box {
|
||||
display: inline-table;
|
||||
border-collapse: separate;
|
||||
border-spacing: 13px 17px;
|
||||
}
|
||||
|
||||
.monaco-workbench .part.editor.max-height-478px > .content.empty > .watermark {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.monaco-workbench .part.editor > .content.empty > .watermark dl {
|
||||
display: table-row;
|
||||
opacity: .8;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.monaco-workbench .part.editor > .content.empty > .watermark dt {
|
||||
text-align: right;
|
||||
letter-spacing: 0.04em
|
||||
}
|
||||
|
||||
.monaco-workbench .part.editor > .content.empty > .watermark dd {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.monaco-workbench .part.editor > .content.empty > .watermark dt,
|
||||
.monaco-workbench .part.editor > .content.empty > .watermark dd {
|
||||
display: table-cell;
|
||||
}
|
||||
|
||||
.monaco-workbench .part.editor > .content.empty > .watermark dt,
|
||||
.monaco-workbench .part.editor > .content.empty > .watermark dl {
|
||||
color: rgba(0,0,0,.68);
|
||||
}
|
||||
|
||||
.vs-dark .monaco-workbench .part.editor > .content.empty > .watermark dt,
|
||||
.vs-dark .monaco-workbench .part.editor > .content.empty > .watermark dl {
|
||||
color: rgba(255,255,255,.6);
|
||||
}
|
||||
|
||||
.hc-black .monaco-workbench .part.editor > .content.empty > .watermark dt {
|
||||
color: #FFF;
|
||||
}
|
||||
.hc-black .monaco-workbench .part.editor > .content.empty > .watermark dl {
|
||||
color: #FFF;
|
||||
opacity: 1;
|
||||
}
|
||||
233
src/vs/workbench/contrib/watermark/browser/watermark.ts
Normal file
233
src/vs/workbench/contrib/watermark/browser/watermark.ts
Normal file
@@ -0,0 +1,233 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'vs/css!./watermark';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { isMacintosh, OS } from 'vs/base/common/platform';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import * as nls from 'vs/nls';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
|
||||
import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
|
||||
import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { GlobalNewUntitledFileAction } from 'vs/workbench/contrib/files/browser/fileActions';
|
||||
import { OpenFolderAction, OpenFileFolderAction, OpenFileAction } from 'vs/workbench/browser/actions/workspaceActions';
|
||||
import { ShowAllCommandsAction } from 'vs/workbench/contrib/quickopen/browser/commandsHandler';
|
||||
import { Parts, IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import { StartAction } from 'vs/workbench/contrib/debug/browser/debugActions';
|
||||
import { FindInFilesActionId } from 'vs/workbench/contrib/search/common/constants';
|
||||
import { QUICKOPEN_ACTION_ID } from 'vs/workbench/browser/parts/quickopen/quickopen';
|
||||
import { TERMINAL_COMMAND_ID } from 'vs/workbench/contrib/terminal/common/terminalCommands';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import { KeybindingLabel } from 'vs/base/browser/ui/keybindingLabel/keybindingLabel';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
import { IDimension } from 'vs/platform/layout/browser/layoutService';
|
||||
|
||||
const $ = dom.$;
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
import { OpenConnectionsViewletAction } from 'sql/parts/objectExplorer/common/registeredServer.contribution';
|
||||
|
||||
|
||||
interface WatermarkEntry {
|
||||
text: string;
|
||||
id: string;
|
||||
mac?: boolean;
|
||||
}
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
const showServers: WatermarkEntry = {
|
||||
text: nls.localize('watermark.showServers', 'Show Servers'),
|
||||
id: OpenConnectionsViewletAction.ID
|
||||
};
|
||||
|
||||
const newSqlFile: WatermarkEntry = {
|
||||
text: nls.localize('watermark.newSqlFile', 'New SQL File'),
|
||||
id: GlobalNewUntitledFileAction.ID
|
||||
};
|
||||
|
||||
const showCommands: WatermarkEntry = {
|
||||
text: nls.localize('watermark.showCommands', "Show All Commands"),
|
||||
id: ShowAllCommandsAction.ID
|
||||
};
|
||||
const quickOpen: WatermarkEntry = {
|
||||
text: nls.localize('watermark.quickOpen', "Go to File"),
|
||||
id: QUICKOPEN_ACTION_ID
|
||||
};
|
||||
const openFileNonMacOnly: WatermarkEntry = {
|
||||
text: nls.localize('watermark.openFile', "Open File"),
|
||||
id: OpenFileAction.ID,
|
||||
mac: false
|
||||
};
|
||||
const openFolderNonMacOnly: WatermarkEntry = {
|
||||
text: nls.localize('watermark.openFolder', "Open Folder"),
|
||||
id: OpenFolderAction.ID,
|
||||
mac: false
|
||||
};
|
||||
const openFileOrFolderMacOnly: WatermarkEntry = {
|
||||
text: nls.localize('watermark.openFileFolder', "Open File or Folder"),
|
||||
id: OpenFileFolderAction.ID,
|
||||
mac: true
|
||||
};
|
||||
const openRecent: WatermarkEntry = {
|
||||
text: nls.localize('watermark.openRecent', "Open Recent"),
|
||||
id: 'workbench.action.openRecent'
|
||||
};
|
||||
const newUntitledFile: WatermarkEntry = {
|
||||
text: nls.localize('watermark.newUntitledFile', "New Untitled File"),
|
||||
id: GlobalNewUntitledFileAction.ID
|
||||
};
|
||||
const newUntitledFileMacOnly: WatermarkEntry = assign({ mac: true }, newUntitledFile);
|
||||
const toggleTerminal: WatermarkEntry = {
|
||||
text: nls.localize({ key: 'watermark.toggleTerminal', comment: ['toggle is a verb here'] }, "Toggle Terminal"),
|
||||
id: TERMINAL_COMMAND_ID.TOGGLE
|
||||
};
|
||||
|
||||
const findInFiles: WatermarkEntry = {
|
||||
text: nls.localize('watermark.findInFiles', "Find in Files"),
|
||||
id: FindInFilesActionId
|
||||
};
|
||||
const startDebugging: WatermarkEntry = {
|
||||
text: nls.localize('watermark.startDebugging', "Start Debugging"),
|
||||
id: StartAction.ID
|
||||
};
|
||||
|
||||
// {{SQL CARBON EDIT}} - Replace noFolderEntries and folderEntries
|
||||
const noFolderEntries = [
|
||||
showServers,
|
||||
newSqlFile,
|
||||
findInFiles
|
||||
];
|
||||
|
||||
const folderEntries = [
|
||||
showServers,
|
||||
newSqlFile,
|
||||
findInFiles
|
||||
];
|
||||
// {{SQL CARBON EDIT}} - End
|
||||
|
||||
const WORKBENCH_TIPS_ENABLED_KEY = 'workbench.tips.enabled';
|
||||
|
||||
export class WatermarkContribution implements IWorkbenchContribution {
|
||||
|
||||
private toDispose: IDisposable[] = [];
|
||||
private watermark: HTMLElement;
|
||||
private enabled: boolean;
|
||||
private workbenchState: WorkbenchState;
|
||||
|
||||
constructor(
|
||||
@ILifecycleService lifecycleService: ILifecycleService,
|
||||
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService,
|
||||
@IKeybindingService private readonly keybindingService: IKeybindingService,
|
||||
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@IEditorGroupsService private readonly editorGroupsService: IEditorGroupsService
|
||||
) {
|
||||
this.workbenchState = contextService.getWorkbenchState();
|
||||
|
||||
lifecycleService.onShutdown(this.dispose, this);
|
||||
this.enabled = this.configurationService.getValue<boolean>(WORKBENCH_TIPS_ENABLED_KEY);
|
||||
if (this.enabled) {
|
||||
this.create();
|
||||
}
|
||||
this.toDispose.push(this.configurationService.onDidChangeConfiguration(e => {
|
||||
if (e.affectsConfiguration(WORKBENCH_TIPS_ENABLED_KEY)) {
|
||||
const enabled = this.configurationService.getValue<boolean>(WORKBENCH_TIPS_ENABLED_KEY);
|
||||
if (enabled !== this.enabled) {
|
||||
this.enabled = enabled;
|
||||
if (this.enabled) {
|
||||
this.create();
|
||||
} else {
|
||||
this.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
this.toDispose.push(this.contextService.onDidChangeWorkbenchState(e => {
|
||||
const previousWorkbenchState = this.workbenchState;
|
||||
this.workbenchState = this.contextService.getWorkbenchState();
|
||||
|
||||
if (this.enabled && this.workbenchState !== previousWorkbenchState) {
|
||||
this.recreate();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
private create(): void {
|
||||
const container = this.layoutService.getContainer(Parts.EDITOR_PART);
|
||||
container.classList.add('has-watermark');
|
||||
|
||||
this.watermark = $('.watermark');
|
||||
const box = dom.append(this.watermark, $('.watermark-box'));
|
||||
const folder = this.workbenchState !== WorkbenchState.EMPTY;
|
||||
const selected = folder ? folderEntries : noFolderEntries
|
||||
.filter(entry => !('mac' in entry) || entry.mac === isMacintosh)
|
||||
.filter(entry => !!CommandsRegistry.getCommand(entry.id));
|
||||
const update = () => {
|
||||
dom.clearNode(box);
|
||||
selected.map(entry => {
|
||||
const dl = dom.append(box, $('dl'));
|
||||
const dt = dom.append(dl, $('dt'));
|
||||
dt.textContent = entry.text;
|
||||
const dd = dom.append(dl, $('dd'));
|
||||
const keybinding = new KeybindingLabel(dd, OS, { renderUnboundKeybindings: true });
|
||||
keybinding.set(this.keybindingService.lookupKeybinding(entry.id));
|
||||
dd.innerHTML = keybinding.element.outerHTML;
|
||||
});
|
||||
};
|
||||
update();
|
||||
dom.prepend(container.firstElementChild as HTMLElement, this.watermark);
|
||||
this.toDispose.push(this.keybindingService.onDidUpdateKeybindings(update));
|
||||
this.toDispose.push(this.editorGroupsService.onDidLayout(dimension => this.handleEditorPartSize(container, dimension)));
|
||||
this.handleEditorPartSize(container, this.editorGroupsService.dimension);
|
||||
}
|
||||
|
||||
private handleEditorPartSize(container: HTMLElement, dimension: IDimension): void {
|
||||
if (dimension.height <= 478) {
|
||||
dom.addClass(container, 'max-height-478px');
|
||||
} else {
|
||||
dom.removeClass(container, 'max-height-478px');
|
||||
}
|
||||
}
|
||||
|
||||
private destroy(): void {
|
||||
if (this.watermark) {
|
||||
this.watermark.remove();
|
||||
const container = this.layoutService.getContainer(Parts.EDITOR_PART);
|
||||
container.classList.remove('has-watermark');
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private recreate(): void {
|
||||
this.destroy();
|
||||
this.create();
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this.toDispose = dispose(this.toDispose);
|
||||
}
|
||||
}
|
||||
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
|
||||
.registerWorkbenchContribution(WatermarkContribution, LifecyclePhase.Restored);
|
||||
|
||||
Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
|
||||
.registerConfiguration({
|
||||
'id': 'workbench',
|
||||
'order': 7,
|
||||
'title': nls.localize('workbenchConfigurationTitle', "Workbench"),
|
||||
'properties': {
|
||||
'workbench.tips.enabled': {
|
||||
'type': 'boolean',
|
||||
'default': true,
|
||||
'description': nls.localize('tips.enabled', "When enabled, will show the watermark tips when no editor is open.")
|
||||
},
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user