Merge from vscode 011858832762aaff245b2336fb1c38166e7a10fb (#4663)

This commit is contained in:
Anthony Dresser
2019-03-22 13:07:54 -07:00
committed by GitHub
parent f5c9174c2f
commit 4a87a24235
296 changed files with 2531 additions and 2472 deletions

View File

@@ -110,7 +110,7 @@ class Menu implements IMenu {
const [id, items] = group;
const activeActions: Array<MenuItemAction | SubmenuItemAction> = [];
for (const item of items) {
if (this._contextKeyService.contextMatchesRules(item.when || null)) {
if (this._contextKeyService.contextMatchesRules(item.when)) {
const action = isIMenuItem(item) ? new MenuItemAction(item.command, item.alt, options, this._contextKeyService, this._commandService) : new SubmenuItemAction(item);
activeActions.push(action);
}

View File

@@ -454,7 +454,7 @@ export class Configuration {
if (workspace && resource) {
const root = workspace.getFolder(resource);
if (root) {
return this._folderConfigurations.get(root.uri) || null;
return types.withUndefinedAsNull(this._folderConfigurations.get(root.uri));
}
}
return null;

View File

@@ -19,7 +19,7 @@ import { testFile } from 'vs/base/test/node/utils';
class SettingsTestEnvironmentService extends EnvironmentService {
constructor(args: ParsedArgs, _execPath: string, private customAppSettingsHome) {
constructor(args: ParsedArgs, _execPath: string, private customAppSettingsHome: string) {
super(args, _execPath);
}

View File

@@ -252,7 +252,7 @@ export abstract class AbstractContextKeyService implements IContextKeyService {
return new ScopedContextKeyService(this, this._onDidChangeContextKey, domNode);
}
public contextMatchesRules(rules: ContextKeyExpr | null): boolean {
public contextMatchesRules(rules: ContextKeyExpr | undefined): boolean {
if (this._isDisposed) {
throw new Error(`AbstractContextKeyService has been disposed`);
}

View File

@@ -58,14 +58,15 @@ export abstract class ContextKeyExpr {
public static greaterThanEquals(key: string, value: any): ContextKeyExpr {
return new ContextKeyGreaterThanEqualsExpr(key, value);
}
public static lessThanEquals(key: string, value: any): ContextKeyExpr {
return new ContextKeyLessThanEqualsExpr(key, value);
}
//
public static deserialize(serialized: string | null | undefined, strict: boolean = false): ContextKeyExpr | null {
public static deserialize(serialized: string | null | undefined, strict: boolean = false): ContextKeyExpr | undefined {
if (!serialized) {
return null;
return undefined;
}
let pieces = serialized.split('&&');
@@ -167,7 +168,7 @@ export abstract class ContextKeyExpr {
public abstract getType(): ContextKeyExprType;
public abstract equals(other: ContextKeyExpr): boolean;
public abstract evaluate(context: IContext): boolean;
public abstract normalize(): ContextKeyExpr | null;
public abstract normalize(): ContextKeyExpr | undefined;
public abstract serialize(): string;
public abstract keys(): string[];
public abstract map(mapFnc: IContextKeyExprMapper): ContextKeyExpr;
@@ -549,9 +550,9 @@ export class ContextKeyAndExpr implements ContextKeyExpr {
return expr;
}
public normalize(): ContextKeyExpr | null {
public normalize(): ContextKeyExpr | undefined {
if (this.expr.length === 0) {
return null;
return undefined;
}
if (this.expr.length === 1) {
@@ -762,7 +763,7 @@ export interface IContextKeyService {
onDidChangeContext: Event<IContextKeyChangeEvent>;
createKey<T>(key: string, defaultValue: T | undefined): IContextKey<T>;
contextMatchesRules(rules: ContextKeyExpr | null): boolean;
contextMatchesRules(rules: ContextKeyExpr | undefined): boolean;
getContextKeyValue<T>(key: string): T | undefined;
createScoped(target?: IContextKeyServiceTarget): IContextKeyService;

View File

@@ -5,50 +5,38 @@
import 'vs/css!./contextMenuHandler';
import { combinedDisposable, IDisposable, dispose } from 'vs/base/common/lifecycle';
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import { combinedDisposable, IDisposable } from 'vs/base/common/lifecycle';
import { ActionRunner, IRunEvent } from 'vs/base/common/actions';
import { Menu } from 'vs/base/browser/ui/menu/menu';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IContextMenuDelegate } from 'vs/base/browser/contextmenu';
import { addDisposableListener, EventType, $, removeNode } from 'vs/base/browser/dom';
import { EventType, $, removeNode } from 'vs/base/browser/dom';
import { attachMenuStyler } from 'vs/platform/theme/common/styler';
import { domEvent } from 'vs/base/browser/event';
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
export interface IContextMenuHandlerOptions {
blockMouse: boolean;
}
export class ContextMenuHandler {
private element: HTMLElement | null;
private elementDisposable: IDisposable;
private menuContainerElement: HTMLElement | null;
private focusToReturn: HTMLElement;
private block: HTMLElement | null;
private options: IContextMenuHandlerOptions = { blockMouse: true };
constructor(
private layoutService: ILayoutService,
private contextViewService: IContextViewService,
private telemetryService: ITelemetryService,
private notificationService: INotificationService,
private keybindingService: IKeybindingService,
private themeService: IThemeService
) {
this.setContainer(this.layoutService.container);
}
) { }
setContainer(container: HTMLElement | null): void {
if (this.element) {
this.elementDisposable = dispose(this.elementDisposable);
this.element = null;
}
if (container) {
this.element = container;
this.elementDisposable = addDisposableListener(this.element, EventType.MOUSE_DOWN, (e) => this.onMouseDown(e as MouseEvent));
}
configure(options: IContextMenuHandlerOptions): void {
this.options = options;
}
showContextMenu(delegate: IContextMenuDelegate): void {
@@ -67,8 +55,6 @@ export class ContextMenuHandler {
anchorAlignment: delegate.anchorAlignment,
render: (container) => {
this.menuContainerElement = container;
let className = delegate.getMenuClassName ? delegate.getMenuClassName() : '';
if (className) {
@@ -76,7 +62,7 @@ export class ContextMenuHandler {
}
// Render invisible div to block mouse interaction in the rest of the UI
if (this.layoutService.hasWorkbench) {
if (this.options.blockMouse) {
this.block = container.appendChild($('.context-view-block'));
}
@@ -120,8 +106,6 @@ export class ContextMenuHandler {
if (this.focusToReturn) {
this.focusToReturn.focus();
}
this.menuContainerElement = null;
}
});
}
@@ -150,27 +134,4 @@ export class ContextMenuHandler {
this.notificationService.error(e.error);
}
}
private onMouseDown(e: MouseEvent): void {
if (!this.menuContainerElement) {
return;
}
let event = new StandardMouseEvent(e);
let element: HTMLElement | null = event.target;
while (element) {
if (element === this.menuContainerElement) {
return;
}
element = element.parentElement;
}
this.contextViewService.hideContextView();
}
dispose(): void {
this.setContainer(null);
}
}

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ContextMenuHandler } from './contextMenuHandler';
import { ContextMenuHandler, IContextMenuHandlerOptions } from './contextMenuHandler';
import { IContextViewService, IContextMenuService } from './contextView';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { Event, Emitter } from 'vs/base/common/event';
@@ -12,7 +12,6 @@ import { IContextMenuDelegate } from 'vs/base/browser/contextmenu';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { Disposable } from 'vs/base/common/lifecycle';
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
export class ContextMenuService extends Disposable implements IContextMenuService {
_serviceBrand: any;
@@ -23,7 +22,6 @@ export class ContextMenuService extends Disposable implements IContextMenuServic
private contextMenuHandler: ContextMenuHandler;
constructor(
@ILayoutService layoutService: ILayoutService,
@ITelemetryService telemetryService: ITelemetryService,
@INotificationService notificationService: INotificationService,
@IContextViewService contextViewService: IContextViewService,
@@ -32,15 +30,11 @@ export class ContextMenuService extends Disposable implements IContextMenuServic
) {
super();
this.contextMenuHandler = this._register(new ContextMenuHandler(layoutService, contextViewService, telemetryService, notificationService, keybindingService, themeService));
this.contextMenuHandler = new ContextMenuHandler(contextViewService, telemetryService, notificationService, keybindingService, themeService);
}
dispose(): void {
this.contextMenuHandler.dispose();
}
setContainer(container: HTMLElement): void {
this.contextMenuHandler.setContainer(container);
configure(options: IContextMenuHandlerOptions): void {
this.contextMenuHandler.configure(options);
}
// ContextMenu

View File

@@ -391,7 +391,7 @@ function collectWorkspaceStats(folder: string, filter: string[]): Promise<Worksp
const MAX_FILES = 20000;
function walk(dir: string, filter: string[], token, done: (allFiles: string[]) => void): void {
function walk(dir: string, filter: string[], token: { count: any; maxReached: any; }, done: (allFiles: string[]) => void): void {
let results: string[] = [];
readdir(dir, async (err, files) => {
// Ignore folders that can't be read

View File

@@ -11,7 +11,7 @@ import { parseExtensionHostPort, parseUserDataDir } from 'vs/platform/environmen
suite('EnvironmentService', () => {
test('parseExtensionHostPort when built', () => {
const parse = a => parseExtensionHostPort(parseArgs(a), true);
const parse = (a: string[]) => parseExtensionHostPort(parseArgs(a), true);
assert.deepEqual(parse([]), { port: null, break: false, debugId: undefined });
assert.deepEqual(parse(['--debugPluginHost']), { port: null, break: false, debugId: undefined });
@@ -28,7 +28,7 @@ suite('EnvironmentService', () => {
});
test('parseExtensionHostPort when unbuilt', () => {
const parse = a => parseExtensionHostPort(parseArgs(a), false);
const parse = (a: string[]) => parseExtensionHostPort(parseArgs(a), false);
assert.deepEqual(parse([]), { port: 5870, break: false, debugId: undefined });
assert.deepEqual(parse(['--debugPluginHost']), { port: 5870, break: false, debugId: undefined });
@@ -45,7 +45,7 @@ suite('EnvironmentService', () => {
});
test('userDataPath', () => {
const parse = (a, b: { cwd: () => string, env: { [key: string]: string } }) => parseUserDataDir(parseArgs(a), <any>b);
const parse = (a: string[], b: { cwd: () => string, env: { [key: string]: string } }) => parseUserDataDir(parseArgs(a), <any>b);
assert.equal(parse(['--user-data-dir', './dir'], { cwd: () => '/foo', env: {} }), path.resolve('/foo/dir'),
'should use cwd when --user-data-dir is specified');

View File

@@ -26,7 +26,7 @@ export function getGalleryExtensionId(publisher: string, name: string): string {
export function groupByExtension<T>(extensions: T[], getExtensionIdentifier: (t: T) => IExtensionIdentifier): T[][] {
const byExtension: T[][] = [];
const findGroup = extension => {
const findGroup = (extension: T) => {
for (const group of byExtension) {
if (group.some(e => areSameExtensions(getExtensionIdentifier(e), getExtensionIdentifier(extension)))) {
return group;

View File

@@ -13,7 +13,7 @@ export interface ITranslations {
}
export function localizeManifest(manifest: IExtensionManifest, translations: ITranslations): IExtensionManifest {
const patcher = value => {
const patcher = (value: string) => {
if (typeof value !== 'string') {
return undefined;
}

View File

@@ -54,7 +54,7 @@ export class ExtensionsLifecycle extends Disposable {
return new Promise<void>((c, e) => {
const extensionLifecycleProcess = this.start(lifecycleHook, lifecycleType, args, extension);
let timeoutHandler;
let timeoutHandler: any;
const onexit = (error?: string) => {
if (timeoutHandler) {

View File

@@ -44,7 +44,7 @@ export class ExtensionManagementChannel implements IServerChannel {
this.onDidUninstallExtension = Event.buffer(service.onDidUninstallExtension, true);
}
listen(context, event: string): Event<any> {
listen(context: any, event: string): Event<any> {
const uriTransformer = this.getUriTransformer(context);
switch (event) {
case 'onInstallExtension': return this.onInstallExtension;
@@ -56,7 +56,7 @@ export class ExtensionManagementChannel implements IServerChannel {
throw new Error('Invalid listen');
}
call(context, command: string, args?: any): Promise<any> {
call(context: any, command: string, args?: any): Promise<any> {
const uriTransformer: IURITransformer | null = this.getUriTransformer(context);
switch (command) {
case 'zip': return this.service.zip(transformIncomingExtension(args[0], uriTransformer)).then(uri => transformOutgoingURI(uri, uriTransformer));

View File

@@ -170,7 +170,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
private collectFiles(extension: ILocalExtension): Promise<IFile[]> {
const collectFilesFromDirectory = async (dir): Promise<string[]> => {
const collectFilesFromDirectory = async (dir: string): Promise<string[]> => {
let entries = await pfs.readdir(dir);
entries = entries.map(e => path.join(dir, e));
const stats = await Promise.all(entries.map(e => pfs.stat(e)));
@@ -288,7 +288,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
this.reportTelemetry(this.getTelemetryEvent(operation), getGalleryExtensionTelemetryData(extension), new Date().getTime() - startTime, undefined);
};
const onDidInstallExtensionFailure = (extension: IGalleryExtension, operation: InstallOperation, error) => {
const onDidInstallExtensionFailure = (extension: IGalleryExtension, operation: InstallOperation, error: Error) => {
const errorCode = error && (<ExtensionManagementError>error).code ? (<ExtensionManagementError>error).code : ERROR_UNKNOWN;
this.logService.error(`Failed to install extension:`, extension.identifier.id, error ? error.message : errorCode);
this._onDidInstallExtension.fire({ identifier: extension.identifier, gallery: extension, operation, error: errorCode });

View File

@@ -84,13 +84,18 @@ export interface IFileService {
* If the optional parameter "resolveSingleChildDescendants" is specified in options,
* the stat service is asked to automatically resolve child folders that only
* contain a single element.
*
* If the optional parameter "resolveMetadata" is specified in options,
* the stat will contain metadata information such as size, mtime and etag.
*/
resolveFile(resource: URI, options: IResolveMetadataFileOptions): Promise<IFileStatWithMetadata>;
resolveFile(resource: URI, options?: IResolveFileOptions): Promise<IFileStat>;
/**
* Same as resolveFile but supports resolving multiple resources in parallel.
* If one of the resolve targets fails to resolve returns a fake IFileStat instead of making the whole call fail.
*/
resolveFiles(toResolve: { resource: URI, options: IResolveMetadataFileOptions }[]): Promise<IResolveFileResult[]>;
resolveFiles(toResolve: { resource: URI, options?: IResolveFileOptions }[]): Promise<IResolveFileResult[]>;
/**
@@ -115,21 +120,21 @@ export interface IFileService {
/**
* Updates the content replacing its previous value.
*/
updateContent(resource: URI, value: string | ITextSnapshot, options?: IUpdateContentOptions): Promise<IFileStat>;
updateContent(resource: URI, value: string | ITextSnapshot, options?: IUpdateContentOptions): Promise<IFileStatWithMetadata>;
/**
* Moves the file to a new path identified by the resource.
*
* The optional parameter overwrite can be set to replace an existing file at the location.
*/
moveFile(source: URI, target: URI, overwrite?: boolean): Promise<IFileStat>;
moveFile(source: URI, target: URI, overwrite?: boolean): Promise<IFileStatWithMetadata>;
/**
* Copies the file to a path identified by the resource.
*
* The optional parameter overwrite can be set to replace an existing file at the location.
*/
copyFile(source: URI, target: URI, overwrite?: boolean): Promise<IFileStat>;
copyFile(source: URI, target: URI, overwrite?: boolean): Promise<IFileStatWithMetadata>;
/**
* Creates a new file with the given path. The returned promise
@@ -137,13 +142,13 @@ export interface IFileService {
*
* The optional parameter content can be used as value to fill into the new file.
*/
createFile(resource: URI, content?: string, options?: ICreateFileOptions): Promise<IFileStat>;
createFile(resource: URI, content?: string, options?: ICreateFileOptions): Promise<IFileStatWithMetadata>;
/**
* Creates a new folder with the given path. The returned promise
* will have the stat model object as a result.
*/
createFolder(resource: URI): Promise<IFileStat>;
createFolder(resource: URI): Promise<IFileStatWithMetadata>;
/**
* Deletes the provided file. The optional useTrash parameter allows to
@@ -194,9 +199,9 @@ export enum FileType {
export interface IStat {
type: FileType;
mtime: number;
ctime: number;
size: number;
mtime?: number;
ctime?: number;
size?: number;
}
export interface IWatchOptions {
@@ -329,7 +334,7 @@ export const enum FileOperation {
export class FileOperationEvent {
constructor(private _resource: URI, private _operation: FileOperation, private _target?: IFileStat) {
constructor(private _resource: URI, private _operation: FileOperation, private _target?: IFileStatWithMetadata) {
}
get resource(): URI {
@@ -481,7 +486,7 @@ export function isParent(path: string, candidate: string, ignoreCase?: boolean):
return path.indexOf(candidate) === 0;
}
export interface IBaseStat {
interface IBaseStat {
/**
* The unified resource identifier of this file or folder.
@@ -494,15 +499,29 @@ export interface IBaseStat {
*/
name: string;
/**
* The size of the file.
*
* The value may or may not be resolved as
* it is optional.
*/
size?: number;
/**
* The last modifictaion date represented
* as millis from unix epoch.
*
* The value may or may not be resolved as
* it is optional.
*/
mtime: number;
mtime?: number;
/**
* A unique identifier thet represents the
* current state of the file or directory.
*
* The value may or may not be resolved as
* it is optional.
*/
etag?: string;
@@ -512,6 +531,12 @@ export interface IBaseStat {
isReadonly?: boolean;
}
export interface IBaseStatWithMetadata extends IBaseStat {
mtime: number;
etag: string;
size: number;
}
/**
* A file resource with meta information.
*/
@@ -532,11 +557,13 @@ export interface IFileStat extends IBaseStat {
* The children of the file stat or undefined if none.
*/
children?: IFileStat[];
}
/**
* The size of the file if known.
*/
size?: number;
export interface IFileStatWithMetadata extends IFileStat, IBaseStatWithMetadata {
mtime: number;
etag: string;
size: number;
children?: IFileStatWithMetadata[];
}
export interface IResolveFileResult {
@@ -544,10 +571,14 @@ export interface IResolveFileResult {
success: boolean;
}
export interface IResolveFileResultWithMetadata extends IResolveFileResult {
stat?: IFileStatWithMetadata;
}
/**
* Content and meta information of a file.
*/
export interface IContent extends IBaseStat {
export interface IContent extends IBaseStatWithMetadata {
/**
* The content of a text file.
@@ -614,7 +645,7 @@ export function snapshotToString(snapshot: ITextSnapshot): string {
/**
* Streamable content and meta information of a file.
*/
export interface IStreamContent extends IBaseStat {
export interface IStreamContent extends IBaseStatWithMetadata {
/**
* The streamable content of a text file.
@@ -712,6 +743,16 @@ export interface IResolveFileOptions {
* Automatically continue resolving children of a directory if the number of children is 1.
*/
resolveSingleChildDescendants?: boolean;
/**
* Will resolve mtime, size and etag of files if enabled. This can have a negative impact
* on performance and thus should only be used when these values are required.
*/
resolveMetadata?: boolean;
}
export interface IResolveMetadataFileOptions extends IResolveFileOptions {
resolveMetadata: true;
}
export interface ICreateFileOptions {
@@ -1033,6 +1074,17 @@ export enum FileKind {
export const MIN_MAX_MEMORY_SIZE_MB = 2048;
export const FALLBACK_MAX_MEMORY_SIZE_MB = 4096;
export function etag(mtime: number, size: number): string;
export function etag(mtime: number | undefined, size: number | undefined): string | undefined;
export function etag(mtime: number | undefined, size: number | undefined): string | undefined {
if (typeof size !== 'number' || typeof mtime !== 'number') {
return undefined;
}
return mtime.toString(29) + size.toString(31);
}
// TODO@ben remove traces of legacy file service
export const ILegacyFileService = createDecorator<ILegacyFileService>('legacyFileService');
export interface ILegacyFileService {
@@ -1049,10 +1101,6 @@ export interface ILegacyFileService {
updateContent(resource: URI, value: string | ITextSnapshot, options?: IUpdateContentOptions): Promise<IFileStat>;
moveFile(source: URI, target: URI, overwrite?: boolean): Promise<IFileStat>;
copyFile(source: URI, target: URI, overwrite?: boolean): Promise<IFileStat>;
createFile(resource: URI, content?: string, options?: ICreateFileOptions): Promise<IFileStat>;
del(resource: URI, options?: { useTrash?: boolean, recursive?: boolean }): Promise<void>;

View File

@@ -71,7 +71,7 @@ class Service1Consumer {
class Target2Dep {
constructor(@IService1 service1: IService1, @IService2 service2) {
constructor(@IService1 service1: IService1, @IService2 service2: Service2) {
assert.ok(service1 instanceof Service1);
assert.ok(service2 instanceof Service2);
}
@@ -99,7 +99,7 @@ class TargetOptional {
}
class DependentServiceTarget {
constructor(@IDependentService d) {
constructor(@IDependentService d: IDependentService) {
assert.ok(d);
assert.equal(d.name, 'farboo');
}

View File

@@ -72,7 +72,7 @@ export class IssueService implements IIssueService {
}
});
ipcMain.on('vscode:workbenchCommand', (_: unknown, commandInfo) => {
ipcMain.on('vscode:workbenchCommand', (_: unknown, commandInfo: { id: any; from: any; args: any; }) => {
const { id, from, args } = commandInfo;
let parentWindow: BrowserWindow | null;
@@ -92,7 +92,7 @@ export class IssueService implements IIssueService {
}
});
ipcMain.on('vscode:openExternal', (_: unknown, arg) => {
ipcMain.on('vscode:openExternal', (_: unknown, arg: string) => {
this.windowsService.openExternal(arg);
});

View File

@@ -50,7 +50,7 @@ export class KeybindingResolver {
}
}
private static _isTargetedForRemoval(defaultKb: ResolvedKeybindingItem, keypressFirstPart: string | null, keypressChordPart: string | null, command: string, when: ContextKeyExpr | null): boolean {
private static _isTargetedForRemoval(defaultKb: ResolvedKeybindingItem, keypressFirstPart: string | null, keypressChordPart: string | null, command: string, when: ContextKeyExpr | undefined): boolean {
if (defaultKb.command !== command) {
return false;
}
@@ -172,7 +172,7 @@ export class KeybindingResolver {
* Returns true if it is provable `a` implies `b`.
* **Precondition**: Assumes `a` and `b` are normalized!
*/
public static whenIsEntirelyIncluded(a: ContextKeyExpr | null, b: ContextKeyExpr | null): boolean {
public static whenIsEntirelyIncluded(a: ContextKeyExpr | null | undefined, b: ContextKeyExpr | null | undefined): boolean {
if (!b) {
return true;
}
@@ -304,7 +304,7 @@ export class KeybindingResolver {
return null;
}
public static contextMatchesRules(context: IContext, rules: ContextKeyExpr | null): boolean {
public static contextMatchesRules(context: IContext, rules: ContextKeyExpr | null | undefined): boolean {
if (!rules) {
return true;
}

View File

@@ -49,7 +49,7 @@ export interface IKeybindingRule2 {
id: string;
args?: any;
weight: number;
when: ContextKeyExpr | null;
when: ContextKeyExpr | undefined;
}
export const enum KeybindingWeight {

View File

@@ -15,10 +15,10 @@ export class ResolvedKeybindingItem {
public readonly bubble: boolean;
public readonly command: string | null;
public readonly commandArgs: any;
public readonly when: ContextKeyExpr | null;
public readonly when: ContextKeyExpr | undefined;
public readonly isDefault: boolean;
constructor(resolvedKeybinding: ResolvedKeybinding | null, command: string | null, commandArgs: any, when: ContextKeyExpr | null, 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

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

View File

@@ -26,7 +26,7 @@ suite('KeybindingResolver', () => {
resolvedKeybinding,
command,
commandArgs,
when ? when.normalize() : null,
when ? when.normalize() : undefined,
isDefault
);
}

View File

@@ -215,7 +215,8 @@ export class LaunchService implements ILaunchService {
preferNewWindow: !args['reuse-window'] && !args.wait,
forceReuseWindow: args['reuse-window'],
diffMode: args.diff,
addMode: args.add
addMode: args.add,
noRecentEntry: !!args['skip-add-to-recently-opened']
});
}

View File

@@ -32,10 +32,4 @@ export interface ILayoutService {
* event carries the dimensions of the container as part of it.
*/
readonly onLayout: Event<IDimension>;
/**
* Indicates if the layout has a workbench surrounding the editor
*/
readonly hasWorkbench: boolean;
}

View File

@@ -56,7 +56,7 @@ export class LifecycleService extends AbstractLifecycleService {
const windowId = this.windowService.getCurrentWindowId();
// Main side indicates that window is about to unload, check for vetos
ipc.on('vscode:onBeforeUnload', (event, reply: { okChannel: string, cancelChannel: string, reason: ShutdownReason }) => {
ipc.on('vscode:onBeforeUnload', (_event: unknown, reply: { okChannel: string, cancelChannel: string, reason: ShutdownReason }) => {
this.logService.trace(`lifecycle: onBeforeUnload (reason: ${reply.reason})`);
// trigger onBeforeShutdown events and veto collecting
@@ -75,7 +75,7 @@ export class LifecycleService extends AbstractLifecycleService {
});
// Main side indicates that we will indeed shutdown
ipc.on('vscode:onWillUnload', (event, reply: { replyChannel: string, reason: ShutdownReason }) => {
ipc.on('vscode:onWillUnload', (_event: unknown, reply: { replyChannel: string, reason: ShutdownReason }) => {
this.logService.trace(`lifecycle: onWillUnload (reason: ${reply.reason})`);
// trigger onWillShutdown events and joining

View File

@@ -276,7 +276,7 @@ export class LifecycleService extends Disposable implements ILifecycleService {
});
// Window After Closing
window.win.on('closed', e => {
window.win.on('closed', () => {
this.logService.trace(`Lifecycle#window.on('closed') - window ID ${window.id}`);
// update window count

View File

@@ -11,6 +11,7 @@ export interface IRemoteAgentEnvironment {
pid: number;
appRoot: URI;
appSettingsHome: URI;
appSettingsPath: URI;
logsPath: URI;
extensionsPath: URI;
extensionHostLogsPath: URI;

View File

@@ -85,7 +85,7 @@ suite('StorageService', () => {
test('Migrate Data', async () => {
class StorageTestEnvironmentService extends EnvironmentService {
constructor(private workspaceStorageFolderPath: string, private _extensionsPath) {
constructor(private workspaceStorageFolderPath: string, private _extensionsPath: string) {
super(parseArgs(process.argv), process.execPath);
}

View File

@@ -326,6 +326,6 @@ export const defaultMenuStyles = <IMenuStyleOverrides>{
separatorColor: menuSeparatorBackground
};
export function attachMenuStyler(widget: IThemable, themeService, style?: IMenuStyleOverrides): IDisposable {
export function attachMenuStyler(widget: IThemable, themeService: IThemeService, style?: IMenuStyleOverrides): IDisposable {
return attachStyler(themeService, { ...defaultMenuStyles, ...style }, widget);
}

View File

@@ -182,6 +182,7 @@ export interface IOpenSettings {
forceOpenWorkspaceAsFile?: boolean;
diffMode?: boolean;
addMode?: boolean;
noRecentEntry?: boolean;
args?: ParsedArgs;
}

View File

@@ -134,6 +134,7 @@ export interface IOpenConfiguration {
addMode?: boolean;
readonly forceOpenWorkspaceAsFile?: boolean;
readonly initialStartup?: boolean;
readonly noRecentEntry?: boolean;
}
export interface ISharedProcess {

View File

@@ -273,7 +273,7 @@ export class WindowsService implements IWindowsService, IURLHandler, IDisposable
});
}
async openWindow(windowId: number, urisToOpen: IURIToOpen[], options?: IOpenSettings): Promise<void> {
async openWindow(windowId: number, urisToOpen: IURIToOpen[], options: IOpenSettings = {}): Promise<void> {
this.logService.trace('windowsService#openWindow');
if (!urisToOpen || !urisToOpen.length) {
return undefined;
@@ -283,12 +283,13 @@ export class WindowsService implements IWindowsService, IURLHandler, IDisposable
context: OpenContext.API,
contextWindowId: windowId,
urisToOpen: urisToOpen,
cli: options && options.args ? { ...this.environmentService.args, ...options.args } : this.environmentService.args,
forceNewWindow: options && options.forceNewWindow,
forceReuseWindow: options && options.forceReuseWindow,
forceOpenWorkspaceAsFile: options && options.forceOpenWorkspaceAsFile,
diffMode: options && options.diffMode,
addMode: options && options.addMode
cli: options.args ? { ...this.environmentService.args, ...options.args } : this.environmentService.args,
forceNewWindow: options.forceNewWindow,
forceReuseWindow: options.forceReuseWindow,
forceOpenWorkspaceAsFile: options.forceOpenWorkspaceAsFile,
diffMode: options.diffMode,
addMode: options.addMode,
noRecentEntry: options.noRecentEntry
});
}

View File

@@ -64,7 +64,7 @@ suite('WorkspacesMainService', () => {
return pfs.del(untitledWorkspacesHomePath, os.tmpdir());
});
function assertPathEquals(p1: string, p2): void {
function assertPathEquals(p1: string, p2: string): void {
if (isWindows) {
p1 = normalizeDriveLetter(p1);
p2 = normalizeDriveLetter(p2);