mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05: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:
@@ -6,7 +6,7 @@
|
||||
import * as nls from 'vs/nls';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import * as errors from 'vs/base/common/errors';
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import { equals, deepClone, assign } from 'vs/base/common/objects';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { Separator } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { IAction, Action } from 'vs/base/common/actions';
|
||||
@@ -14,7 +14,6 @@ import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { toResource, IUntitledResourceInput } from 'vs/workbench/common/editor';
|
||||
import { IEditorService, IResourceEditor } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
|
||||
import { IWindowsService, IWindowService, IWindowSettings, IOpenFileRequest, IWindowsConfiguration, IAddFoldersRequest, IRunActionInWindowRequest, IPathData, IRunKeybindingInWindowRequest } from 'vs/platform/windows/common/windows';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { ITitleService } from 'vs/workbench/services/title/common/titleService';
|
||||
@@ -23,22 +22,27 @@ import * as browser from 'vs/base/browser/browser';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { IResourceInput } from 'vs/platform/editor/common/editor';
|
||||
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 { ipcRenderer as ipc, webFrame, crashReporter, Event } from 'electron';
|
||||
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 { fillInActionBarActions } from 'vs/platform/actions/browser/menuItemActionItem';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { IDisposable, dispose, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { LifecyclePhase, ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IIntegrityService } from 'vs/platform/integrity/common/integrity';
|
||||
import { AccessibilitySupport, isRootUser, isWindows, isMacintosh } from 'vs/base/common/platform';
|
||||
import product from 'vs/platform/node/product';
|
||||
import { IIntegrityService } from 'vs/workbench/services/integrity/common/integrity';
|
||||
import { isRootUser, isWindows, isMacintosh, isLinux } from 'vs/base/common/platform';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
import pkg from 'vs/platform/product/node/package';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { EditorServiceImpl } from 'vs/workbench/browser/parts/editor/editor';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IAccessibilityService, AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility';
|
||||
import { WorkbenchState, IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { coalesce } from 'vs/base/common/arrays';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
const TextInputActions: IAction[] = [
|
||||
new Action('undo', nls.localize('undo', "Undo"), undefined, true, () => Promise.resolve(document.execCommand('undo'))),
|
||||
@@ -51,7 +55,7 @@ const TextInputActions: IAction[] = [
|
||||
new Action('editor.action.selectAll', nls.localize('selectAll', "Select All"), undefined, true, () => Promise.resolve(document.execCommand('selectAll')))
|
||||
];
|
||||
|
||||
export class ElectronWindow extends Themable {
|
||||
export class ElectronWindow extends Disposable {
|
||||
|
||||
private touchBarMenu?: IMenu;
|
||||
private touchBarUpdater: RunOnceScheduler;
|
||||
@@ -63,11 +67,13 @@ export class ElectronWindow extends Themable {
|
||||
private addFoldersScheduler: RunOnceScheduler;
|
||||
private pendingFoldersToAdd: URI[];
|
||||
|
||||
private closeEmptyWindowScheduler: RunOnceScheduler = this._register(new RunOnceScheduler(() => this.onAllEditorsClosed(), 50));
|
||||
|
||||
constructor(
|
||||
@IEditorService private readonly editorService: EditorServiceImpl,
|
||||
@IWindowsService private readonly windowsService: IWindowsService,
|
||||
@IWindowService private readonly windowService: IWindowService,
|
||||
@IWorkspaceConfigurationService private readonly configurationService: IWorkspaceConfigurationService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@ITitleService private readonly titleService: ITitleService,
|
||||
@IWorkbenchThemeService protected themeService: IWorkbenchThemeService,
|
||||
@INotificationService private readonly notificationService: INotificationService,
|
||||
@@ -79,9 +85,12 @@ export class ElectronWindow extends Themable {
|
||||
@IFileService private readonly fileService: IFileService,
|
||||
@IMenuService private readonly menuService: IMenuService,
|
||||
@ILifecycleService private readonly lifecycleService: ILifecycleService,
|
||||
@IIntegrityService private readonly integrityService: IIntegrityService
|
||||
@IIntegrityService private readonly integrityService: IIntegrityService,
|
||||
@IEnvironmentService private readonly environmentService: IEnvironmentService,
|
||||
@IAccessibilityService private readonly accessibilityService: IAccessibilityService,
|
||||
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService
|
||||
) {
|
||||
super(themeService);
|
||||
super();
|
||||
|
||||
this.touchBarDisposables = [];
|
||||
|
||||
@@ -105,7 +114,7 @@ export class ElectronWindow extends Themable {
|
||||
});
|
||||
|
||||
// Support runAction event
|
||||
ipc.on('vscode:runAction', (event: any, request: IRunActionInWindowRequest) => {
|
||||
ipc.on('vscode:runAction', (event: Event, request: IRunActionInWindowRequest) => {
|
||||
const args: any[] = request.args || [];
|
||||
|
||||
// If we run an action from the touchbar, we fill in the currently active resource
|
||||
@@ -136,29 +145,27 @@ export class ElectronWindow extends Themable {
|
||||
});
|
||||
|
||||
// Support runKeybinding event
|
||||
ipc.on('vscode:runKeybinding', (event: any, request: IRunKeybindingInWindowRequest) => {
|
||||
ipc.on('vscode:runKeybinding', (event: Event, request: IRunKeybindingInWindowRequest) => {
|
||||
if (document.activeElement) {
|
||||
this.keybindingService.dispatchByUserSettingsLabel(request.userSettingsLabel, document.activeElement);
|
||||
}
|
||||
});
|
||||
|
||||
// Error reporting from main
|
||||
ipc.on('vscode:reportError', (event: any, error: string) => {
|
||||
ipc.on('vscode:reportError', (event: Event, error: string) => {
|
||||
if (error) {
|
||||
const errorParsed = JSON.parse(error);
|
||||
errorParsed.mainProcess = true;
|
||||
errors.onUnexpectedError(errorParsed);
|
||||
errors.onUnexpectedError(JSON.parse(error));
|
||||
}
|
||||
});
|
||||
|
||||
// Support openFiles event for existing and new files
|
||||
ipc.on('vscode:openFiles', (event: any, request: IOpenFileRequest) => this.onOpenFiles(request));
|
||||
ipc.on('vscode:openFiles', (event: Event, request: IOpenFileRequest) => this.onOpenFiles(request));
|
||||
|
||||
// Support addFolders event if we have a workspace opened
|
||||
ipc.on('vscode:addFolders', (event: any, request: IAddFoldersRequest) => this.onAddFoldersRequest(request));
|
||||
ipc.on('vscode:addFolders', (event: Event, request: IAddFoldersRequest) => this.onAddFoldersRequest(request));
|
||||
|
||||
// Message support
|
||||
ipc.on('vscode:showInfoMessage', (event: any, message: string) => {
|
||||
ipc.on('vscode:showInfoMessage', (event: Event, message: string) => {
|
||||
this.notificationService.info(message);
|
||||
});
|
||||
|
||||
@@ -200,8 +207,8 @@ export class ElectronWindow extends Themable {
|
||||
});
|
||||
|
||||
// keyboard layout changed event
|
||||
ipc.on('vscode:accessibilitySupportChanged', (event: any, accessibilitySupportEnabled: boolean) => {
|
||||
browser.setAccessibilitySupport(accessibilitySupportEnabled ? AccessibilitySupport.Enabled : AccessibilitySupport.Disabled);
|
||||
ipc.on('vscode:accessibilitySupportChanged', (event: Event, accessibilitySupportEnabled: boolean) => {
|
||||
this.accessibilityService.setAccessibilitySupport(accessibilitySupportEnabled ? AccessibilitySupport.Enabled : AccessibilitySupport.Disabled);
|
||||
});
|
||||
|
||||
// Zoom level changes
|
||||
@@ -214,6 +221,51 @@ export class ElectronWindow extends Themable {
|
||||
|
||||
// Context menu support in input/textarea
|
||||
window.document.addEventListener('contextmenu', e => this.onContextMenu(e));
|
||||
|
||||
// Listen to visible editor changes
|
||||
this._register(this.editorService.onDidVisibleEditorsChange(() => this.onDidVisibleEditorsChange()));
|
||||
|
||||
// Listen to editor closing (if we run with --wait)
|
||||
const filesToWait = this.windowService.getConfiguration().filesToWait;
|
||||
if (filesToWait) {
|
||||
const resourcesToWaitFor = coalesce(filesToWait.paths.map(p => p.fileUri));
|
||||
const waitMarkerFile = URI.file(filesToWait.waitMarkerFilePath);
|
||||
const listenerDispose = this.editorService.onDidCloseEditor(() => this.onEditorClosed(listenerDispose, resourcesToWaitFor, waitMarkerFile));
|
||||
|
||||
this._register(listenerDispose);
|
||||
}
|
||||
}
|
||||
|
||||
private onDidVisibleEditorsChange(): void {
|
||||
|
||||
// Close when empty: check if we should close the window based on the setting
|
||||
// Overruled by: window has a workspace opened or this window is for extension development
|
||||
// or setting is disabled. Also enabled when running with --wait from the command line.
|
||||
const visibleEditors = this.editorService.visibleControls;
|
||||
if (visibleEditors.length === 0 && this.contextService.getWorkbenchState() === WorkbenchState.EMPTY && !this.environmentService.isExtensionDevelopment) {
|
||||
const closeWhenEmpty = this.configurationService.getValue<boolean>('window.closeWhenEmpty');
|
||||
if (closeWhenEmpty || this.environmentService.args.wait) {
|
||||
this.closeEmptyWindowScheduler.schedule();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private onAllEditorsClosed(): void {
|
||||
const visibleEditors = this.editorService.visibleControls.length;
|
||||
if (visibleEditors === 0) {
|
||||
this.windowService.closeWindow();
|
||||
}
|
||||
}
|
||||
|
||||
private onEditorClosed(listenerDispose: IDisposable, resourcesToWaitFor: URI[], waitMarkerFile: URI): void {
|
||||
|
||||
// In wait mode, listen to changes to the editors and wait until the files
|
||||
// are closed that the user wants to wait for. When this happens we delete
|
||||
// the wait marker file to signal to the outside that editing is done.
|
||||
if (resourcesToWaitFor.every(resource => !this.editorService.isOpen({ resource }))) {
|
||||
listenerDispose.dispose();
|
||||
this.fileService.del(waitMarkerFile);
|
||||
}
|
||||
}
|
||||
|
||||
private onContextMenu(e: MouseEvent): void {
|
||||
@@ -260,7 +312,7 @@ export class ElectronWindow extends Themable {
|
||||
|
||||
// Handle window.open() calls
|
||||
const $this = this;
|
||||
(<any>window).open = function (url: string, target: string, features: string, replace: boolean): any {
|
||||
window.open = function (url: string, target: string, features: string, replace: boolean): Window | null {
|
||||
$this.windowsService.openExternal(url);
|
||||
|
||||
return null;
|
||||
@@ -297,6 +349,11 @@ export class ElectronWindow extends Themable {
|
||||
|
||||
// Touchbar menu (if enabled)
|
||||
this.updateTouchbarMenu();
|
||||
|
||||
// Crash reporter (if enabled)
|
||||
if (!this.environmentService.disableCrashReporter && product.crashReporter && product.hockeyApp && this.configurationService.getValue('telemetry.enableCrashReporter')) {
|
||||
this.setupCrashReporter();
|
||||
}
|
||||
}
|
||||
|
||||
private updateTouchbarMenu(): void {
|
||||
@@ -354,12 +411,40 @@ export class ElectronWindow extends Themable {
|
||||
}
|
||||
|
||||
// Only update if the actions have changed
|
||||
if (!objects.equals(this.lastInstalledTouchedBar, items)) {
|
||||
if (!equals(this.lastInstalledTouchedBar, items)) {
|
||||
this.lastInstalledTouchedBar = items;
|
||||
this.windowService.updateTouchBar(items);
|
||||
}
|
||||
}
|
||||
|
||||
private setupCrashReporter(): void {
|
||||
|
||||
// base options with product info
|
||||
const options = {
|
||||
companyName: product.crashReporter.companyName,
|
||||
productName: product.crashReporter.productName,
|
||||
submitURL: isWindows ? product.hockeyApp[`win32-${process.arch}`] : isLinux ? product.hockeyApp[`linux-${process.arch}`] : product.hockeyApp.darwin,
|
||||
extra: {
|
||||
vscode_version: pkg.version,
|
||||
vscode_commit: product.commit
|
||||
}
|
||||
};
|
||||
|
||||
// mixin telemetry info
|
||||
this.telemetryService.getTelemetryInfo()
|
||||
.then(info => {
|
||||
assign(options.extra, {
|
||||
vscode_sessionId: info.sessionId
|
||||
});
|
||||
|
||||
// start crash reporter right here
|
||||
crashReporter.start(deepClone(options));
|
||||
|
||||
// start crash reporter in the main process
|
||||
return this.windowsService.startCrashReporter(options);
|
||||
});
|
||||
}
|
||||
|
||||
private onAddFoldersRequest(request: IAddFoldersRequest): void {
|
||||
|
||||
// Buffer all pending requests
|
||||
|
||||
Reference in New Issue
Block a user