Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998 (#7880)

* Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998

* fix pipelines

* fix strict-null-checks

* add missing files
This commit is contained in:
Anthony Dresser
2019-10-21 22:12:22 -07:00
committed by GitHub
parent 7c9be74970
commit 1e22f47304
913 changed files with 18898 additions and 16536 deletions

View File

@@ -7,13 +7,19 @@ import { Action } from 'vs/base/common/actions';
import * as nls from 'vs/nls';
import { IElectronService } from 'vs/platform/electron/node/electron';
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
export class ToggleDevToolsAction extends Action {
static readonly ID = 'workbench.action.toggleDevTools';
static LABEL = nls.localize('toggleDevTools', "Toggle Developer Tools");
static readonly LABEL = nls.localize('toggleDevTools', "Toggle Developer Tools");
constructor(id: string, label: string, @IElectronService private readonly electronService: IElectronService) {
constructor(
id: string,
label: string,
@IElectronService private readonly electronService: IElectronService
) {
super(id, label);
}
@@ -25,9 +31,13 @@ export class ToggleDevToolsAction extends Action {
export class ToggleSharedProcessAction extends Action {
static readonly ID = 'workbench.action.toggleSharedProcess';
static LABEL = nls.localize('toggleSharedProcess', "Toggle Shared Process");
static readonly LABEL = nls.localize('toggleSharedProcess', "Toggle Shared Process");
constructor(id: string, label: string, @ISharedProcessService private readonly sharedProcessService: ISharedProcessService) {
constructor(
id: string,
label: string,
@ISharedProcessService private readonly sharedProcessService: ISharedProcessService
) {
super(id, label);
}
@@ -35,3 +45,22 @@ export class ToggleSharedProcessAction extends Action {
return this.sharedProcessService.toggleSharedProcessWindow();
}
}
export class ConfigureRuntimeArgumentsAction extends Action {
static readonly ID = 'workbench.action.configureRuntimeArguments';
static readonly LABEL = nls.localize('configureRuntimeArguments', "Configure Runtime Arguments");
constructor(
id: string,
label: string,
@IEnvironmentService private readonly environmentService: IEnvironmentService,
@IEditorService private readonly editorService: IEditorService
) {
super(id, label);
}
async run(): Promise<void> {
await this.editorService.openEditor({ resource: this.environmentService.argvResource });
}
}

View File

@@ -137,10 +137,10 @@ export class ZoomResetAction extends BaseZoomAction {
}
}
export class RestartWithExtensionsDisabledAction extends Action {
export class ReloadWindowWithExtensionsDisabledAction extends Action {
static readonly ID = 'workbench.action.restartWithExtensionsDisabled';
static LABEL = nls.localize('restartWithExtensionsDisabled', "Restart With Extensions Disabled");
static readonly ID = 'workbench.action.reloadWindowWithExtensionsDisabled';
static readonly LABEL = nls.localize('reloadWindowWithExtensionsDisabled', "Reload With Extensions Disabled");
constructor(
id: string,
@@ -151,7 +151,7 @@ export class RestartWithExtensionsDisabledAction extends Action {
}
async run(): Promise<boolean> {
await this.electronService.relaunch({ addArgs: ['--disable-extensions'] });
await this.electronService.reload({ disableExtensions: true });
return true;
}
@@ -217,7 +217,7 @@ export abstract class BaseSwitchWindow extends Action {
export class SwitchWindow extends BaseSwitchWindow {
static readonly ID = 'workbench.action.switchWindow';
static LABEL = nls.localize('switchWindow', "Switch Window...");
static readonly LABEL = nls.localize('switchWindow', "Switch Window...");
constructor(
id: string,
@@ -240,7 +240,7 @@ export class SwitchWindow extends BaseSwitchWindow {
export class QuickSwitchWindow extends BaseSwitchWindow {
static readonly ID = 'workbench.action.quickSwitchWindow';
static LABEL = nls.localize('quickSwitchWindow', "Quick Switch Window...");
static readonly LABEL = nls.localize('quickSwitchWindow', "Quick Switch Window...");
constructor(
id: string,

View File

@@ -14,7 +14,7 @@ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/
export class SaveWorkspaceAsAction extends Action {
static readonly ID = 'workbench.action.saveWorkspaceAs';
static LABEL = nls.localize('saveWorkspaceAsAction', "Save Workspace As...");
static readonly LABEL = nls.localize('saveWorkspaceAsAction', "Save Workspace As...");
constructor(
id: string,

View File

@@ -11,8 +11,8 @@ import { IConfigurationRegistry, Extensions as ConfigurationExtensions, Configur
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import { isWindows, isLinux, isMacintosh } from 'vs/base/common/platform';
import { ToggleSharedProcessAction, ToggleDevToolsAction } from 'vs/workbench/electron-browser/actions/developerActions';
import { ZoomResetAction, ZoomOutAction, ZoomInAction, CloseCurrentWindowAction, SwitchWindow, QuickSwitchWindow, RestartWithExtensionsDisabledAction, NewWindowTabHandler, ShowPreviousWindowTabHandler, ShowNextWindowTabHandler, MoveWindowTabToNewWindowHandler, MergeWindowTabsHandlerHandler, ToggleWindowTabsBarHandler } from 'vs/workbench/electron-browser/actions/windowActions';
import { ToggleSharedProcessAction, ToggleDevToolsAction, ConfigureRuntimeArgumentsAction } from 'vs/workbench/electron-browser/actions/developerActions';
import { ZoomResetAction, ZoomOutAction, ZoomInAction, CloseCurrentWindowAction, SwitchWindow, QuickSwitchWindow, ReloadWindowWithExtensionsDisabledAction, NewWindowTabHandler, ShowPreviousWindowTabHandler, ShowNextWindowTabHandler, MoveWindowTabToNewWindowHandler, MergeWindowTabsHandlerHandler, ToggleWindowTabsBarHandler } from 'vs/workbench/electron-browser/actions/windowActions';
import { SaveWorkspaceAsAction, DuplicateWorkspaceInNewWindowAction } from 'vs/workbench/electron-browser/actions/workspaceActions';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
@@ -21,6 +21,7 @@ import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation
import { SupportsWorkspacesContext, IsMacContext, HasMacNativeTabsContext, IsDevelopmentContext } from 'vs/workbench/browser/contextkeys';
import { NoEditorsVisibleContext, SingleEditorGroupsContext } from 'vs/workbench/common/editor';
import { IElectronService } from 'vs/platform/electron/node/electron';
import { IJSONContributionRegistry, Extensions as JSONExtensions } from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
import { InstallVSIXAction } from 'vs/workbench/contrib/extensions/browser/extensionsActions'; // {{SQL CARBON EDIT}} add import
@@ -100,7 +101,8 @@ import { InstallVSIXAction } from 'vs/workbench/contrib/extensions/browser/exten
(function registerDeveloperActions(): void {
const developerCategory = nls.localize('developer', "Developer");
registry.registerWorkbenchAction(new SyncActionDescriptor(ToggleSharedProcessAction, ToggleSharedProcessAction.ID, ToggleSharedProcessAction.LABEL), 'Developer: Toggle Shared Process', developerCategory);
registry.registerWorkbenchAction(new SyncActionDescriptor(RestartWithExtensionsDisabledAction, RestartWithExtensionsDisabledAction.ID, RestartWithExtensionsDisabledAction.LABEL), 'Developer: Restart With Extensions Disabled', developerCategory);
registry.registerWorkbenchAction(new SyncActionDescriptor(ConfigureRuntimeArgumentsAction, ConfigureRuntimeArgumentsAction.ID, ConfigureRuntimeArgumentsAction.LABEL), 'Developer: Configure Runtime Arguments', developerCategory);
registry.registerWorkbenchAction(new SyncActionDescriptor(ReloadWindowWithExtensionsDisabledAction, ReloadWindowWithExtensionsDisabledAction.ID, ReloadWindowWithExtensionsDisabledAction.LABEL), 'Developer: Reload With Extensions Disabled', developerCategory);
registry.registerWorkbenchAction(new SyncActionDescriptor(ToggleDevToolsAction, ToggleDevToolsAction.ID, ToggleDevToolsAction.LABEL), 'Developer: Toggle Developer Tools', developerCategory);
KeybindingsRegistry.registerKeybindingRule({
@@ -317,7 +319,7 @@ import { InstallVSIXAction } from 'vs/workbench/contrib/extensions/browser/exten
'default': false,
'scope': ConfigurationScope.APPLICATION,
'description': nls.localize('window.nativeTabs', "Enables macOS Sierra window tabs. Note that changes require a full restart to apply and that native tabs will disable a custom title bar style if configured."),
'included': isMacintosh && parseFloat(os.release()) >= 16 // Minimum: macOS Sierra (10.12.x = darwin 16.x)
'included': isMacintosh && parseFloat(os.release()) >= 17 // Minimum: macOS Sierra (10.13.x = darwin 17.x)
},
'window.nativeFullScreen': {
'type': 'boolean',
@@ -352,3 +354,32 @@ import { InstallVSIXAction } from 'vs/workbench/contrib/extensions/browser/exten
}
});
})();
// JSON Schemas
(function registerJSONSchemas(): void {
const argvDefinitionFileSchemaId = 'vscode://schemas/argv';
const jsonRegistry = Registry.as<IJSONContributionRegistry>(JSONExtensions.JSONContribution);
jsonRegistry.registerSchema(argvDefinitionFileSchemaId, {
id: argvDefinitionFileSchemaId,
allowComments: true,
allowTrailingCommas: true,
description: 'VSCode static command line definition file',
type: 'object',
additionalProperties: false,
properties: {
locale: {
type: 'string',
description: nls.localize('argv.locale', 'The display Language to use. Picking a different language requires the associated language pack to be installed.')
},
'disable-hardware-acceleration': {
type: 'boolean',
description: nls.localize('argv.disableHardwareAcceleration', 'Disables hardware acceleration. ONLY change this option if you encounter graphic issues.')
},
'disable-color-correct-rendering': {
type: 'boolean',
description: nls.localize('argv.disableColorCorrectRendering', 'Resolves issues around color profile selection. ONLY change this option if you encounter graphic issues.')
}
}
});
})();

View File

@@ -96,7 +96,7 @@ class DesktopMain extends Disposable {
}
const filesToWait = this.environmentService.configuration.filesToWait;
const filesToWaitPaths = filesToWait && filesToWait.paths;
const filesToWaitPaths = filesToWait?.paths;
[filesToWaitPaths, this.environmentService.configuration.filesToOpenOrCreate, this.environmentService.configuration.filesToDiff].forEach(paths => {
if (Array.isArray(paths)) {
paths.forEach(path => {

View File

@@ -50,7 +50,7 @@ import { IUpdateService } from 'vs/platform/update/common/update';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { IPreferencesService } from '../services/preferences/common/preferences';
import { IMenubarService, IMenubarData, IMenubarMenu, IMenubarKeybinding, IMenubarMenuItemSubmenu, IMenubarMenuItemAction, MenubarMenuItem } from 'vs/platform/menubar/node/menubar';
import { withNullAsUndefined } from 'vs/base/common/types';
import { withNullAsUndefined, assertIsDefined } from 'vs/base/common/types';
import { IOpenerService, OpenOptions } from 'vs/platform/opener/common/opener';
import { Schemas } from 'vs/base/common/network';
import { IElectronService } from 'vs/platform/electron/node/electron';
@@ -192,7 +192,7 @@ export class ElectronWindow extends Disposable {
// High Contrast Events
ipc.on('vscode:enterHighContrast', async () => {
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');
if (windowConfig && windowConfig.autoDetectHighContrast) {
if (windowConfig?.autoDetectHighContrast) {
await this.lifecycleService.when(LifecyclePhase.Ready);
this.themeService.setColorTheme(VS_HC_THEME, undefined);
}
@@ -200,7 +200,7 @@ export class ElectronWindow extends Disposable {
ipc.on('vscode:leaveHighContrast', async () => {
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');
if (windowConfig && windowConfig.autoDetectHighContrast) {
if (windowConfig?.autoDetectHighContrast) {
await this.lifecycleService.when(LifecyclePhase.Ready);
this.themeService.restoreColorTheme();
}
@@ -253,7 +253,7 @@ export class ElectronWindow extends Disposable {
// Maximize/Restore on doubleclick (for macOS custom title)
if (isMacintosh && getTitleBarStyle(this.configurationService, this.environmentService) === 'custom') {
const titlePart = this.layoutService.getContainer(Parts.TITLEBAR_PART);
const titlePart = assertIsDefined(this.layoutService.getContainer(Parts.TITLEBAR_PART));
this._register(DOM.addDisposableListener(titlePart, DOM.EventType.DBLCLICK, e => {
DOM.EventHelper.stop(e);
@@ -423,7 +423,7 @@ export class ElectronWindow extends Disposable {
this.openerService.registerExternalUriResolver({
resolveExternalUri: async (uri: URI, options?: OpenOptions) => {
if (options && options.allowTunneling) {
if (options?.allowTunneling) {
const portMappingRequest = extractLocalHostUriMetaDataForPortMapping(uri);
if (portMappingRequest) {
const tunnel = await this.tunnelService.openTunnel(portMappingRequest.port);
@@ -443,7 +443,7 @@ export class ElectronWindow extends Disposable {
private shouldOpenExternal(resource: URI, options?: OpenOptions) {
const scheme = resource.scheme.toLowerCase();
const preferOpenExternal = (scheme === Schemas.mailto || scheme === Schemas.http || scheme === Schemas.https);
return (options && options.openExternal) || preferOpenExternal;
return options?.openExternal || preferOpenExternal;
}
private updateTouchbarMenu(): void {
@@ -632,8 +632,8 @@ export class ElectronWindow extends Disposable {
await this.lifecycleService.when(LifecyclePhase.Ready);
// In diffMode we open 2 resources as diff
if (diffMode && resources.length === 2) {
return this.editorService.openEditor({ leftResource: resources[0].resource!, rightResource: resources[1].resource!, options: { pinned: true } });
if (diffMode && resources.length === 2 && resources[0].resource && resources[1].resource) {
return this.editorService.openEditor({ leftResource: resources[0].resource, rightResource: resources[1].resource, options: { pinned: true } });
}
// For one file, just put it into the current active editor
@@ -702,6 +702,11 @@ class NativeMenubarControl extends MenubarControl {
}
protected doUpdateMenubar(firstTime: boolean): void {
// Since the native menubar is shared between windows (main process)
// only allow the focused window to update the menubar
if (!this.hostService.hasFocus) {
return;
}
// Send menus to main process to be rendered by Electron
const menubarData = { menus: {}, keybindings: {} };
@@ -742,8 +747,8 @@ class NativeMenubarControl extends MenubarControl {
const submenu = { items: [] };
if (!this.menus[menuItem.item.submenu]) {
this.menus[menuItem.item.submenu] = this.menuService.createMenu(menuItem.item.submenu, this.contextKeyService);
this._register(this.menus[menuItem.item.submenu]!.onDidChange(() => this.updateMenubar()));
const menu = this.menus[menuItem.item.submenu] = this.menuService.createMenu(menuItem.item.submenu, this.contextKeyService);
this._register(menu.onDidChange(() => this.updateMenubar()));
}
const menuToDispose = this.menuService.createMenu(menuItem.item.submenu, this.contextKeyService);