mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Initial VS Code 1.19 source merge (#571)
* Initial 1.19 xcopy * Fix yarn build * Fix numerous build breaks * Next batch of build break fixes * More build break fixes * Runtime breaks * Additional post merge fixes * Fix windows setup file * Fix test failures. * Update license header blocks to refer to source eula
This commit is contained in:
@@ -17,7 +17,6 @@ import DOM = require('vs/base/browser/dom');
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { Separator } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { IAction, Action } from 'vs/base/common/actions';
|
||||
import { IPartService } from 'vs/workbench/services/part/common/partService';
|
||||
import { AutoSaveConfiguration, IFileService } from 'vs/platform/files/common/files';
|
||||
import { toResource } from 'vs/workbench/common/editor';
|
||||
import { IWorkbenchEditorService, IResourceInputType } from 'vs/workbench/services/editor/common/editorService';
|
||||
@@ -27,7 +26,6 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
|
||||
import { IWindowsService, IWindowService, IWindowSettings, IPath, IOpenFileRequest, IWindowsConfiguration, IAddFoldersRequest, IRunActionInWindowRequest } from 'vs/platform/windows/common/windows';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { ITitleService } from 'vs/workbench/services/title/common/titleService';
|
||||
import { IWorkbenchThemeService, VS_HC_THEME, VS_DARK_THEME } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
@@ -39,14 +37,15 @@ import { IExtensionService } from 'vs/platform/extensions/common/extensions';
|
||||
import { KeyboardMapperFactory } from 'vs/workbench/services/keybinding/electron-browser/keybindingService';
|
||||
import { Themable } from 'vs/workbench/common/theme';
|
||||
import { ipcRenderer as ipc, webFrame } from 'electron';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common/workspaceEditing';
|
||||
import { IMenuService, MenuId, IMenu, MenuItemAction, ICommandAction } from 'vs/platform/actions/common/actions';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { fillInActions } from 'vs/platform/actions/browser/menuItemActionItem';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { ConfigurationTarget, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
|
||||
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||
import { LifecyclePhase, ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces';
|
||||
|
||||
const TextInputActions: IAction[] = [
|
||||
new Action('undo', nls.localize('undo', "Undo"), null, true, () => document.execCommand('undo') && TPromise.as(true)),
|
||||
@@ -61,7 +60,7 @@ const TextInputActions: IAction[] = [
|
||||
|
||||
export class ElectronWindow extends Themable {
|
||||
|
||||
private static AUTO_SAVE_SETTING = 'files.autoSave';
|
||||
private static readonly AUTO_SAVE_SETTING = 'files.autoSave';
|
||||
|
||||
private touchBarUpdater: RunOnceScheduler;
|
||||
private touchBarMenu: IMenu;
|
||||
@@ -70,11 +69,13 @@ export class ElectronWindow extends Themable {
|
||||
|
||||
private previousConfiguredZoomLevel: number;
|
||||
|
||||
private addFoldersScheduler: RunOnceScheduler;
|
||||
private pendingFoldersToAdd: IAddFoldersRequest[];
|
||||
|
||||
constructor(
|
||||
shellContainer: HTMLElement,
|
||||
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
|
||||
@IEditorGroupService private editorGroupService: IEditorGroupService,
|
||||
@IPartService private partService: IPartService,
|
||||
@IWindowsService private windowsService: IWindowsService,
|
||||
@IWindowService private windowService: IWindowService,
|
||||
@IWorkspaceConfigurationService private configurationService: IWorkspaceConfigurationService,
|
||||
@@ -86,13 +87,11 @@ export class ElectronWindow extends Themable {
|
||||
@IViewletService private viewletService: IViewletService,
|
||||
@IContextMenuService private contextMenuService: IContextMenuService,
|
||||
@IKeybindingService private keybindingService: IKeybindingService,
|
||||
@IEnvironmentService private environmentService: IEnvironmentService,
|
||||
@ITelemetryService private telemetryService: ITelemetryService,
|
||||
@IWorkspaceContextService private contextService: IWorkspaceContextService,
|
||||
@IWorkspaceEditingService private workspaceEditingService: IWorkspaceEditingService,
|
||||
@IFileService private fileService: IFileService,
|
||||
@IMenuService private menuService: IMenuService,
|
||||
@IContextKeyService private contextKeyService: IContextKeyService
|
||||
@ILifecycleService private lifecycleService: ILifecycleService
|
||||
) {
|
||||
super(themeService);
|
||||
|
||||
@@ -101,6 +100,10 @@ export class ElectronWindow extends Themable {
|
||||
this.touchBarUpdater = new RunOnceScheduler(() => this.doSetupTouchbar(), 300);
|
||||
this.toUnbind.push(this.touchBarUpdater);
|
||||
|
||||
this.pendingFoldersToAdd = [];
|
||||
this.addFoldersScheduler = new RunOnceScheduler(() => this.doAddFolders(), 100);
|
||||
this.toUnbind.push(this.addFoldersScheduler);
|
||||
|
||||
this.registerListeners();
|
||||
this.create();
|
||||
}
|
||||
@@ -126,7 +129,7 @@ export class ElectronWindow extends Themable {
|
||||
});
|
||||
|
||||
// Support runAction event
|
||||
ipc.on('vscode:runAction', (event, request: IRunActionInWindowRequest) => {
|
||||
ipc.on('vscode:runAction', (_event: any, request: IRunActionInWindowRequest) => {
|
||||
const args: any[] = [];
|
||||
|
||||
// If we run an action from the touchbar, we fill in the currently active resource
|
||||
@@ -157,7 +160,7 @@ export class ElectronWindow extends Themable {
|
||||
});
|
||||
|
||||
// Support resolve keybindings event
|
||||
ipc.on('vscode:resolveKeybindings', (event, rawActionIds: string) => {
|
||||
ipc.on('vscode:resolveKeybindings', (_event: any, rawActionIds: string) => {
|
||||
let actionIds: string[] = [];
|
||||
try {
|
||||
actionIds = JSON.parse(rawActionIds);
|
||||
@@ -173,7 +176,7 @@ export class ElectronWindow extends Themable {
|
||||
}, () => errors.onUnexpectedError);
|
||||
});
|
||||
|
||||
ipc.on('vscode:reportError', (event, error) => {
|
||||
ipc.on('vscode:reportError', (_event: any, error: string) => {
|
||||
if (error) {
|
||||
const errorParsed = JSON.parse(error);
|
||||
errorParsed.mainProcess = true;
|
||||
@@ -182,65 +185,70 @@ export class ElectronWindow extends Themable {
|
||||
});
|
||||
|
||||
// Support openFiles event for existing and new files
|
||||
ipc.on('vscode:openFiles', (event, request: IOpenFileRequest) => this.onOpenFiles(request));
|
||||
ipc.on('vscode:openFiles', (_event: any, request: IOpenFileRequest) => this.onOpenFiles(request));
|
||||
|
||||
// Support addFolders event if we have a workspace opened
|
||||
ipc.on('vscode:addFolders', (event, request: IAddFoldersRequest) => this.onAddFolders(request));
|
||||
ipc.on('vscode:addFolders', (_event: any, request: IAddFoldersRequest) => this.onAddFoldersRequest(request));
|
||||
|
||||
// Message support
|
||||
ipc.on('vscode:showInfoMessage', (event, message: string) => {
|
||||
ipc.on('vscode:showInfoMessage', (_event: any, message: string) => {
|
||||
this.messageService.show(Severity.Info, message);
|
||||
});
|
||||
|
||||
// Support toggling auto save
|
||||
ipc.on('vscode.toggleAutoSave', event => {
|
||||
ipc.on('vscode.toggleAutoSave', () => {
|
||||
this.toggleAutoSave();
|
||||
});
|
||||
|
||||
// Fullscreen Events
|
||||
ipc.on('vscode:enterFullScreen', event => {
|
||||
this.partService.joinCreation().then(() => {
|
||||
ipc.on('vscode:enterFullScreen', () => {
|
||||
this.lifecycleService.when(LifecyclePhase.Running).then(() => {
|
||||
browser.setFullscreen(true);
|
||||
});
|
||||
});
|
||||
|
||||
ipc.on('vscode:leaveFullScreen', event => {
|
||||
this.partService.joinCreation().then(() => {
|
||||
ipc.on('vscode:leaveFullScreen', () => {
|
||||
this.lifecycleService.when(LifecyclePhase.Running).then(() => {
|
||||
browser.setFullscreen(false);
|
||||
});
|
||||
});
|
||||
|
||||
// High Contrast Events
|
||||
ipc.on('vscode:enterHighContrast', event => {
|
||||
const windowConfig = this.configurationService.getConfiguration<IWindowSettings>('window');
|
||||
ipc.on('vscode:enterHighContrast', () => {
|
||||
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');
|
||||
if (windowConfig && windowConfig.autoDetectHighContrast) {
|
||||
this.partService.joinCreation().then(() => {
|
||||
this.lifecycleService.when(LifecyclePhase.Running).then(() => {
|
||||
this.themeService.setColorTheme(VS_HC_THEME, null);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
ipc.on('vscode:leaveHighContrast', event => {
|
||||
const windowConfig = this.configurationService.getConfiguration<IWindowSettings>('window');
|
||||
ipc.on('vscode:leaveHighContrast', () => {
|
||||
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');
|
||||
if (windowConfig && windowConfig.autoDetectHighContrast) {
|
||||
this.partService.joinCreation().then(() => {
|
||||
this.lifecycleService.when(LifecyclePhase.Running).then(() => {
|
||||
this.themeService.setColorTheme(VS_DARK_THEME, null);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// keyboard layout changed event
|
||||
ipc.on('vscode:keyboardLayoutChanged', event => {
|
||||
ipc.on('vscode:keyboardLayoutChanged', () => {
|
||||
KeyboardMapperFactory.INSTANCE._onKeyboardLayoutChanged();
|
||||
});
|
||||
|
||||
// keyboard layout changed event
|
||||
ipc.on('vscode:accessibilitySupportChanged', (event, accessibilitySupportEnabled: boolean) => {
|
||||
ipc.on('vscode:accessibilitySupportChanged', (_event: any, accessibilitySupportEnabled: boolean) => {
|
||||
browser.setAccessibilitySupport(accessibilitySupportEnabled ? platform.AccessibilitySupport.Enabled : platform.AccessibilitySupport.Disabled);
|
||||
});
|
||||
|
||||
// Configuration changes
|
||||
this.toUnbind.push(this.configurationService.onDidChangeConfiguration(e => this.onDidUpdateConfiguration(e)));
|
||||
// Zoom level changes
|
||||
this.updateWindowZoomLevel();
|
||||
this.toUnbind.push(this.configurationService.onDidChangeConfiguration(e => {
|
||||
if (e.affectsConfiguration('window.zoomLevel')) {
|
||||
this.updateWindowZoomLevel();
|
||||
}
|
||||
}));
|
||||
|
||||
// Context menu support in input/textarea
|
||||
window.document.addEventListener('contextmenu', e => this.onContextMenu(e));
|
||||
@@ -261,12 +269,9 @@ export class ElectronWindow extends Themable {
|
||||
}
|
||||
}
|
||||
|
||||
private onDidUpdateConfiguration(event: IConfigurationChangeEvent): void {
|
||||
if (!event.affectsConfiguration('window.zoomLevel')) {
|
||||
return;
|
||||
}
|
||||
private updateWindowZoomLevel(): void {
|
||||
|
||||
const windowConfig: IWindowsConfiguration = this.configurationService.getConfiguration<IWindowsConfiguration>();
|
||||
const windowConfig: IWindowsConfiguration = this.configurationService.getValue<IWindowsConfiguration>();
|
||||
|
||||
let newZoomLevel = 0;
|
||||
if (windowConfig.window && typeof windowConfig.window.zoomLevel === 'number') {
|
||||
@@ -301,12 +306,12 @@ export class ElectronWindow extends Themable {
|
||||
};
|
||||
|
||||
// Send over all extension viewlets when extensions are ready
|
||||
this.extensionService.onReady().then(() => {
|
||||
this.extensionService.whenInstalledExtensionsRegistered().then(() => {
|
||||
ipc.send('vscode:extensionViewlets', JSON.stringify(this.viewletService.getViewlets().filter(v => !!v.extensionId).map(v => { return { id: v.id, label: v.name }; })));
|
||||
});
|
||||
|
||||
// Emit event when vscode has loaded
|
||||
this.partService.joinCreation().then(() => {
|
||||
this.lifecycleService.when(LifecyclePhase.Running).then(() => {
|
||||
ipc.send('vscode:workbenchLoaded', this.windowService.getCurrentWindowId());
|
||||
});
|
||||
|
||||
@@ -375,7 +380,7 @@ export class ElectronWindow extends Themable {
|
||||
}
|
||||
|
||||
private resolveKeybindings(actionIds: string[]): TPromise<{ id: string; label: string, isNative: boolean; }[]> {
|
||||
return TPromise.join([this.partService.joinCreation(), this.extensionService.onReady()]).then(() => {
|
||||
return TPromise.join([this.lifecycleService.when(LifecyclePhase.Running), this.extensionService.whenInstalledExtensionsRegistered()]).then(() => {
|
||||
return arrays.coalesce(actionIds.map(id => {
|
||||
const binding = this.keybindingService.lookupKeybinding(id);
|
||||
if (!binding) {
|
||||
@@ -399,8 +404,25 @@ export class ElectronWindow extends Themable {
|
||||
});
|
||||
}
|
||||
|
||||
private onAddFolders(request: IAddFoldersRequest): void {
|
||||
const foldersToAdd = request.foldersToAdd.map(folderToAdd => ({ uri: URI.file(folderToAdd.filePath) }));
|
||||
private onAddFoldersRequest(request: IAddFoldersRequest): void {
|
||||
|
||||
// Buffer all pending requests
|
||||
this.pendingFoldersToAdd.push(request);
|
||||
|
||||
// Delay the adding of folders a bit to buffer in case more requests are coming
|
||||
if (!this.addFoldersScheduler.isScheduled()) {
|
||||
this.addFoldersScheduler.schedule();
|
||||
}
|
||||
}
|
||||
|
||||
private doAddFolders(): void {
|
||||
const foldersToAdd: IWorkspaceFolderCreationData[] = [];
|
||||
|
||||
this.pendingFoldersToAdd.forEach(request => {
|
||||
foldersToAdd.push(...request.foldersToAdd.map(folderToAdd => ({ uri: URI.file(folderToAdd.filePath) })));
|
||||
});
|
||||
|
||||
this.pendingFoldersToAdd = [];
|
||||
|
||||
this.workspaceEditingService.addFolders(foldersToAdd).done(null, errors.onUnexpectedError);
|
||||
}
|
||||
@@ -422,7 +444,7 @@ export class ElectronWindow extends Themable {
|
||||
}
|
||||
|
||||
if (inputs.length) {
|
||||
this.openResources(inputs, diffMode).done(null, errors.onUnexpectedError);
|
||||
this.openResources(inputs, diffMode).then(null, errors.onUnexpectedError);
|
||||
}
|
||||
|
||||
if (request.filesToWait && inputs.length) {
|
||||
@@ -441,8 +463,8 @@ export class ElectronWindow extends Themable {
|
||||
}
|
||||
}
|
||||
|
||||
private openResources(resources: (IResourceInput | IUntitledResourceInput)[], diffMode: boolean): TPromise<IEditor | IEditor[]> {
|
||||
return this.partService.joinCreation().then((): TPromise<IEditor | IEditor[]> => {
|
||||
private openResources(resources: (IResourceInput | IUntitledResourceInput)[], diffMode: boolean): Thenable<IEditor | IEditor[]> {
|
||||
return this.lifecycleService.when(LifecyclePhase.Running).then((): TPromise<IEditor | IEditor[]> => {
|
||||
|
||||
// In diffMode we open 2 resources as diff
|
||||
if (diffMode && resources.length === 2) {
|
||||
|
||||
Reference in New Issue
Block a user