Revert "Merge from vscode ada4bddb8edc69eea6ebaaa0e88c5f903cbd43d8 (#5529)" (#5553)

This reverts commit 5d44b6a6a7.
This commit is contained in:
Anthony Dresser
2019-05-20 17:07:32 -07:00
committed by GitHub
parent 1315b8e42a
commit c9a4f8f664
325 changed files with 3332 additions and 4501 deletions

View File

@@ -5,7 +5,7 @@
import { addClasses, createCSSRule, removeClasses } from 'vs/base/browser/dom';
import { domEvent } from 'vs/base/browser/event';
import { ActionViewItem, Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { ActionItem, Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { IAction } from 'vs/base/common/actions';
import { Emitter } from 'vs/base/common/event';
import { IdGenerator } from 'vs/base/common/idGenerator';
@@ -114,16 +114,16 @@ export function fillInActions(groups: [string, Array<MenuItemAction | SubmenuIte
}
export function createActionViewItem(action: IAction, keybindingService: IKeybindingService, notificationService: INotificationService, contextMenuService: IContextMenuService): ActionViewItem | undefined {
export function createActionItem(action: IAction, keybindingService: IKeybindingService, notificationService: INotificationService, contextMenuService: IContextMenuService): ActionItem | undefined {
if (action instanceof MenuItemAction) {
return new MenuEntryActionViewItem(action, keybindingService, notificationService, contextMenuService);
return new MenuItemActionItem(action, keybindingService, notificationService, contextMenuService);
}
return undefined;
}
const ids = new IdGenerator('menu-item-action-item-icon-');
export class MenuEntryActionViewItem extends ActionViewItem {
export class MenuItemActionItem extends ActionItem {
static readonly ICON_PATH_TO_CSS_RULES: Map<string /* path*/, string /* CSS rule */> = new Map<string, string>();
@@ -231,13 +231,13 @@ export class MenuEntryActionViewItem extends ActionViewItem {
const iconPathMapKey = item.iconLocation.dark.toString();
if (MenuEntryActionViewItem.ICON_PATH_TO_CSS_RULES.has(iconPathMapKey)) {
iconClass = MenuEntryActionViewItem.ICON_PATH_TO_CSS_RULES.get(iconPathMapKey)!;
if (MenuItemActionItem.ICON_PATH_TO_CSS_RULES.has(iconPathMapKey)) {
iconClass = MenuItemActionItem.ICON_PATH_TO_CSS_RULES.get(iconPathMapKey)!;
} else {
iconClass = ids.nextId();
createCSSRule(`.icon.${iconClass}`, `background-image: url("${(item.iconLocation.light || item.iconLocation.dark).toString()}")`);
createCSSRule(`.vs-dark .icon.${iconClass}, .hc-black .icon.${iconClass}`, `background-image: url("${item.iconLocation.dark.toString()}")`);
MenuEntryActionViewItem.ICON_PATH_TO_CSS_RULES.set(iconPathMapKey, iconClass);
MenuItemActionItem.ICON_PATH_TO_CSS_RULES.set(iconPathMapKey, iconClass);
}
addClasses(this.label, 'icon', iconClass);
@@ -255,10 +255,10 @@ export class MenuEntryActionViewItem extends ActionViewItem {
}
}
// Need to subclass MenuEntryActionViewItem in order to respect
// Need to subclass MenuItemActionItem in order to respect
// the action context coming from any action bar, without breaking
// existing users
export class ContextAwareMenuEntryActionViewItem extends MenuEntryActionViewItem {
export class ContextAwareMenuItemActionItem extends MenuItemActionItem {
onClick(event: MouseEvent): void {
event.preventDefault();
@@ -273,7 +273,7 @@ export class ContextAwareMenuEntryActionViewItem extends MenuEntryActionViewItem
// Always show label for action items, instead of whether they don't have
// an icon/CSS class. Useful for some toolbar scenarios in particular with
// contributed actions from other extensions
export class LabeledMenuItemActionItem extends MenuEntryActionViewItem {
export class LabeledMenuItemActionItem extends MenuItemActionItem {
private _labeledItemClassDispose: IDisposable;
constructor(
@@ -301,13 +301,13 @@ export class LabeledMenuItemActionItem extends MenuEntryActionViewItem {
const iconPathMapKey = item.iconLocation.dark.toString();
if (MenuEntryActionViewItem.ICON_PATH_TO_CSS_RULES.has(iconPathMapKey)) {
iconClass = MenuEntryActionViewItem.ICON_PATH_TO_CSS_RULES.get(iconPathMapKey);
if (MenuItemActionItem.ICON_PATH_TO_CSS_RULES.has(iconPathMapKey)) {
iconClass = MenuItemActionItem.ICON_PATH_TO_CSS_RULES.get(iconPathMapKey);
} else {
iconClass = ids.nextId();
createCSSRule(`.icon.${iconClass}`, `background-image: url("${(item.iconLocation.light || item.iconLocation.dark).toString()}")`);
createCSSRule(`.vs-dark .icon.${iconClass}, .hc-black .icon.${iconClass}`, `background-image: url("${item.iconLocation.dark.toString()}")`);
MenuEntryActionViewItem.ICON_PATH_TO_CSS_RULES.set(iconPathMapKey, iconClass);
MenuItemActionItem.ICON_PATH_TO_CSS_RULES.set(iconPathMapKey, iconClass);
}
addClasses(this.label, 'icon', iconClass, this._defaultCSSClassToAdd);

View File

@@ -18,18 +18,21 @@ export interface ILocalizedString {
original: string;
}
export interface ICommandAction {
export interface IBaseCommandAction {
id: string;
title: string | ILocalizedString;
category?: string | ILocalizedString;
}
export interface ICommandAction extends IBaseCommandAction {
iconLocation?: { dark: URI; light?: URI; };
precondition?: ContextKeyExpr;
toggled?: ContextKeyExpr;
}
type Serialized<T> = { [K in keyof T]: T[K] extends URI ? UriComponents : Serialized<T[K]> };
export type ISerializableCommandAction = Serialized<ICommandAction>;
export interface ISerializableCommandAction extends IBaseCommandAction {
iconLocation?: { dark: UriComponents; light?: UriComponents; };
}
export interface IMenuItem {
command: ICommandAction;

View File

@@ -73,7 +73,7 @@ export class ContextMenuHandler {
actionRunner.onDidBeforeRun(this.onActionRun, this, menuDisposables);
actionRunner.onDidRun(this.onDidActionRun, this, menuDisposables);
menu = new Menu(container, actions, {
actionViewItemProvider: delegate.getActionViewItem,
actionItemProvider: delegate.getActionItem,
context: delegate.getActionsContext ? delegate.getActionsContext() : null,
actionRunner,
getKeyBinding: delegate.getKeyBinding ? delegate.getKeyBinding : action => this.keybindingService.lookupKeybinding(action.id)

View File

@@ -186,8 +186,8 @@ class WindowDriver implements IWindowDriver {
const lines: string[] = [];
for (let i = 0; i < xterm.buffer.length; i++) {
lines.push(xterm.buffer.getLine(i)!.translateToString(true));
for (let i = 0; i < xterm._core.buffer.lines.length; i++) {
lines.push(xterm._core.buffer.translateBufferLineToString(i, true));
}
return lines;

View File

@@ -63,7 +63,7 @@ export interface IBaseResourceInput {
export interface IResourceInput extends IBaseResourceInput {
/**
* The resource URI of the resource to open.
* The resource URL of the resource to open.
*/
resource: URI;
@@ -71,12 +71,6 @@ export interface IResourceInput extends IBaseResourceInput {
* The encoding of the text input if known.
*/
readonly encoding?: string;
/**
* The identifier of the language mode of the text input
* if known to use when displaying the contents.
*/
readonly mode?: string;
}
export interface IEditorOptions {

View File

@@ -69,6 +69,7 @@ export interface ParsedArgs {
'driver'?: string;
'driver-verbose'?: boolean;
remote?: string;
'nodeless'?: boolean; // TODO@ben revisit electron5 nodeless support
// {{SQL CARBON EDIT}}
aad?: boolean;
database?: string;

View File

@@ -95,6 +95,8 @@ export const options: Option[] = [
{ id: 'trace-category-filter', type: 'string' },
{ id: 'trace-options', type: 'string' },
{ id: 'prof-code-loading', type: 'boolean' },
{ id: 'nodeless', type: 'boolean' }, // TODO@ben revisit electron5 nodeless support
// {{SQL CARBON EDIT}}
{ id: 'database', type: 'string', alias: 'D' },
{ id: 'server', type: 'string', alias: 'S' },

View File

@@ -0,0 +1,15 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// See https://github.com/Microsoft/vscode/issues/30180
const WIN32_MAX_FILE_SIZE = 300 * 1024 * 1024; // 300 MB
const GENERAL_MAX_FILE_SIZE = 16 * 1024 * 1024 * 1024; // 16 GB
// See https://github.com/v8/v8/blob/5918a23a3d571b9625e5cce246bdd5b46ff7cd8b/src/heap/heap.cc#L149
const WIN32_MAX_HEAP_SIZE = 700 * 1024 * 1024; // 700 MB
const GENERAL_MAX_HEAP_SIZE = 700 * 2 * 1024 * 1024; // 1400 MB
export const MAX_FILE_SIZE = process.arch === 'ia32' ? WIN32_MAX_FILE_SIZE : GENERAL_MAX_FILE_SIZE;
export const MAX_HEAP_SIZE = process.arch === 'ia32' ? WIN32_MAX_HEAP_SIZE : GENERAL_MAX_HEAP_SIZE;

View File

@@ -299,11 +299,11 @@ export class HistoryMainService implements IHistoryMainService {
description = nls.localize('folderDesc', "{0} {1}", getBaseLabel(workspace), getPathLabel(dirname(workspace), this.environmentService));
args = `--folder-uri "${workspace.toString()}"`;
} else {
description = nls.localize('workspaceDesc', "{0} {1}", getBaseLabel(workspace.configPath), getPathLabel(dirname(workspace.configPath), this.environmentService));
description = nls.localize('codeWorkspace', "Code Workspace");
args = `--file-uri "${workspace.configPath.toString()}"`;
}
return {
return <Electron.JumpListItem>{
type: 'task',
title,
description,

View File

@@ -125,7 +125,7 @@ function storeServiceDependency(id: Function, target: Function, index: number, o
/**
* A *only* valid way to create a {{ServiceIdentifier}}.
*/
export function createDecorator<T>(serviceId: string): ServiceIdentifier<T> {
export function createDecorator<T>(serviceId: string): { (...args: any[]): void; type: T; } {
if (_util.serviceIds.has(serviceId)) {
return _util.serviceIds.get(serviceId)!;

View File

@@ -221,7 +221,7 @@ export class InstantiationService implements IInstantiationService {
// Return a proxy object that's backed by an idle value. That
// strategy is to instantiate services in our idle time or when actually
// needed but not when injected into a consumer
const idle = new IdleValue(() => this._createInstance<T>(ctor, args, _trace));
const idle = new IdleValue(() => this._createInstance(ctor, args, _trace));
return <T>new Proxy(Object.create(null), {
get(_target: T, prop: PropertyKey): any {
return idle.getValue()[prop];

View File

@@ -17,6 +17,7 @@ import { ResolvedKeybindingItem } from 'vs/platform/keybinding/common/resolvedKe
import { INotificationService } from 'vs/platform/notification/common/notification';
import { IStatusbarService } from 'vs/platform/statusbar/common/statusbar';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { withNullAsUndefined } from 'vs/base/common/types';
interface CurrentChord {
keypress: string;
@@ -95,11 +96,11 @@ export abstract class AbstractKeybindingService extends Disposable implements IK
}
public lookupKeybinding(commandId: string): ResolvedKeybinding | undefined {
const result = this._getResolver().lookupPrimaryKeybinding(commandId);
let result = this._getResolver().lookupPrimaryKeybinding(commandId);
if (!result) {
return undefined;
}
return result.resolvedKeybinding;
return withNullAsUndefined(result.resolvedKeybinding);
}
public dispatchEvent(e: IKeyboardEvent, target: IContextKeyServiceTarget): boolean {

View File

@@ -10,7 +10,7 @@ import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
export class ResolvedKeybindingItem {
_resolvedKeybindingItemBrand: void;
public readonly resolvedKeybinding: ResolvedKeybinding | undefined;
public readonly resolvedKeybinding: ResolvedKeybinding | null;
public readonly keypressParts: string[];
public readonly bubble: boolean;
public readonly command: string | null;
@@ -18,7 +18,7 @@ export class ResolvedKeybindingItem {
public readonly when: ContextKeyExpr | undefined;
public readonly isDefault: boolean;
constructor(resolvedKeybinding: ResolvedKeybinding | undefined, command: string | null, commandArgs: any, when: ContextKeyExpr | undefined, isDefault: boolean) {
constructor(resolvedKeybinding: ResolvedKeybinding | null, command: string | null, commandArgs: any, when: ContextKeyExpr | undefined, isDefault: boolean) {
this.resolvedKeybinding = resolvedKeybinding;
this.keypressParts = resolvedKeybinding ? removeElementsAfterNulls(resolvedKeybinding.getDispatchParts()) : [];
this.bubble = (command ? command.charCodeAt(0) === CharCode.Caret : false);

View File

@@ -180,7 +180,7 @@ suite('AbstractKeybindingService', () => {
});
function kbItem(keybinding: number, command: string, when?: ContextKeyExpr): ResolvedKeybindingItem {
const resolvedKeybinding = (keybinding !== 0 ? new USLayoutResolvedKeybinding(createKeybinding(keybinding, OS)!, OS) : undefined);
const resolvedKeybinding = (keybinding !== 0 ? new USLayoutResolvedKeybinding(createKeybinding(keybinding, OS)!, OS) : null);
return new ResolvedKeybindingItem(
resolvedKeybinding,
command,

View File

@@ -21,7 +21,7 @@ function createContext(ctx: any) {
suite('KeybindingResolver', () => {
function kbItem(keybinding: number, command: string, commandArgs: any, when: ContextKeyExpr, isDefault: boolean): ResolvedKeybindingItem {
const resolvedKeybinding = (keybinding !== 0 ? new USLayoutResolvedKeybinding(createKeybinding(keybinding, OS)!, OS) : undefined);
const resolvedKeybinding = (keybinding !== 0 ? new USLayoutResolvedKeybinding(createKeybinding(keybinding, OS)!, OS) : null);
return new ResolvedKeybindingItem(
resolvedKeybinding,
command,

View File

@@ -266,7 +266,7 @@ export class WorkbenchList<T> extends List<T> {
...computeStyles(themeService.getTheme(), defaultListStyles),
...workbenchListOptions,
horizontalScrolling
}
} as IListOptions<T>
);
this.disposables.push(workbenchListOptionsDisposable);
@@ -348,7 +348,7 @@ export class WorkbenchPagedList<T> extends PagedList<T> {
...computeStyles(themeService.getTheme(), defaultListStyles),
...workbenchListOptions,
horizontalScrolling
}
} as IListOptions<T>
);
this.disposables = [workbenchListOptionsDisposable];
@@ -689,7 +689,7 @@ export class TreeResourceNavigator2<T, TFilterData> extends Disposable {
super();
this.options = {
...{
...<IResourceResultsNavigationOptions2>{
openOnSelection: true
},
...(options || {})

View File

@@ -54,4 +54,4 @@ class RegistryImpl implements IRegistry {
}
}
export const Registry: IRegistry = new RegistryImpl();
export const Registry = <IRegistry>new RegistryImpl();

View File

@@ -8,7 +8,7 @@ import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle'
import { URI, UriComponents } from 'vs/base/common/uri';
import { generateUuid } from 'vs/base/common/uuid';
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
import { FileChangeType, FileDeleteOptions, FileOverwriteOptions, FileSystemProviderCapabilities, FileType, IFileChange, IFileSystemProvider, IStat, IWatchOptions, FileOpenOptions } from 'vs/platform/files/common/files';
import { FileChangeType, FileDeleteOptions, FileOverwriteOptions, FileSystemProviderCapabilities, FileType, FileWriteOptions, IFileChange, IFileSystemProvider, IStat, IWatchOptions } from 'vs/platform/files/common/files';
import { VSBuffer } from 'vs/base/common/buffer';
import { IRemoteAgentEnvironment } from 'vs/platform/remote/common/remoteAgentEnvironment';
import { OperatingSystem } from 'vs/base/common/platform';
@@ -50,7 +50,7 @@ export class RemoteExtensionsFileSystemProvider extends Disposable implements IF
setCaseSensitive(isCaseSensitive: boolean) {
let capabilities = (
FileSystemProviderCapabilities.FileOpenReadWriteClose
FileSystemProviderCapabilities.FileReadWrite
| FileSystemProviderCapabilities.FileFolderCopy
);
@@ -68,28 +68,14 @@ export class RemoteExtensionsFileSystemProvider extends Disposable implements IF
return this.channel.call('stat', [resource]);
}
open(resource: URI, opts: FileOpenOptions): Promise<number> {
return this.channel.call('open', [resource, opts]);
async readFile(resource: URI): Promise<Uint8Array> {
const buff = <VSBuffer>await this.channel.call('readFile', [resource]);
return buff.buffer;
}
close(fd: number): Promise<void> {
return this.channel.call('close', [fd]);
}
async read(fd: number, pos: number, data: Uint8Array, offset: number, length: number): Promise<number> {
const [bytes, bytesRead]: [VSBuffer, number] = await this.channel.call('read', [fd, pos, length]);
// copy back the data that was written into the buffer on the remote
// side. we need to do this because buffers are not referenced by
// pointer, but only by value and as such cannot be directly written
// to from the other process.
data.set(bytes.buffer.slice(0, bytesRead), offset);
return bytesRead;
}
write(fd: number, pos: number, data: Uint8Array, offset: number, length: number): Promise<number> {
return this.channel.call('write', [fd, pos, VSBuffer.wrap(data), offset, length]);
writeFile(resource: URI, content: Uint8Array, opts: FileWriteOptions): Promise<void> {
return this.channel.call('writeFile', [resource, VSBuffer.wrap(content), opts]);
}
delete(resource: URI, opts: FileDeleteOptions): Promise<void> {

View File

@@ -27,8 +27,7 @@ export class RemoteAuthorityResolverError extends Error {
return true;
}
}
return this.isTemporarilyNotAvailable(err);
return false;
}
public static isTemporarilyNotAvailable(err: any): boolean {

View File

@@ -40,10 +40,8 @@ export class RemoteAuthorityResolverService implements IRemoteAuthorityResolverS
}
clearResolvedAuthority(authority: string): void {
if (this._resolveAuthorityRequests[authority]) {
this._resolveAuthorityRequests[authority].reject(errors.canceled());
delete this._resolveAuthorityRequests[authority];
}
this._resolveAuthorityRequests[authority].reject(errors.canceled());
delete this._resolveAuthorityRequests[authority];
}
setResolvedAuthority(resolvedAuthority: ResolvedAuthority) {