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

@@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
import { Registry } from 'vs/platform/registry/common/platform';
import { Action, IAction } from 'vs/base/common/actions';
import { BaseActionItem, Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { IAction } from 'vs/base/common/actions';
import { Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { ITree, IActionProvider } from 'vs/base/parts/tree/browser/tree';
import { IInstantiationService, IConstructorSignature0, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
@@ -27,27 +27,6 @@ export class ActionBarContributor {
getActions(context: any): IAction[] {
return [];
}
/**
* Returns true if this contributor has secondary actions for the given context.
*/
hasSecondaryActions(context: any): boolean {
return false;
}
/**
* Returns an array of secondary actions in the given context.
*/
getSecondaryActions(context: any): IAction[] {
return [];
}
/**
* Can return a specific IActionItem to render the given action.
*/
getActionItem(context: any, action: Action): BaseActionItem | null {
return null;
}
}
/**
@@ -101,50 +80,6 @@ export class ContributableActionProvider implements IActionProvider {
return prepareActions(actions);
}
hasSecondaryActions(tree: ITree, element: any): boolean {
const context = this.toContext(tree, element);
const contributors = this.registry.getActionBarContributors(Scope.VIEWER);
for (const contributor of contributors) {
if (contributor.hasSecondaryActions(context)) {
return true;
}
}
return false;
}
getSecondaryActions(tree: ITree, element: any): IAction[] {
const actions: IAction[] = [];
const context = this.toContext(tree, element);
// Collect Actions
const contributors = this.registry.getActionBarContributors(Scope.VIEWER);
for (const contributor of contributors) {
if (contributor.hasSecondaryActions(context)) {
actions.push(...contributor.getSecondaryActions(context));
}
}
return prepareActions(actions);
}
getActionItem(tree: ITree, element: any, action: Action): BaseActionItem | null {
const contributors = this.registry.getActionBarContributors(Scope.VIEWER);
const context = this.toContext(tree, element);
for (let i = contributors.length - 1; i >= 0; i--) {
const contributor = contributors[i];
const itemProvider = contributor.getActionItem(context, action);
if (itemProvider) {
return itemProvider;
}
}
return null;
}
}
// Helper function used in parts to massage actions before showing in action areas
@@ -201,25 +136,6 @@ export const Extensions = {
};
export interface IActionBarRegistry {
/**
* Goes through all action bar contributors and asks them for contributed actions for
* the provided scope and context. Supports primary actions.
*/
getActionBarActionsForContext(scope: string, context: any): IAction[];
/**
* Goes through all action bar contributors and asks them for contributed actions for
* the provided scope and context. Supports secondary actions.
*/
getSecondaryActionBarActionsForContext(scope: string, context: any): IAction[];
/**
* Goes through all action bar contributors and asks them for contributed action item for
* the provided scope and context.
*/
getActionItemForContext(scope: string, context: any, action: Action): BaseActionItem | null;
/**
* Registers an Actionbar contributor. It will be called to contribute actions to all the action bars
* that are used in the Workbench in the given scope.
@@ -264,48 +180,6 @@ class ActionBarRegistry implements IActionBarRegistry {
return this.actionBarContributorInstances[scope] || [];
}
getActionBarActionsForContext(scope: string, context: any): IAction[] {
const actions: IAction[] = [];
// Go through contributors for scope
this.getContributors(scope).forEach((contributor: ActionBarContributor) => {
// Primary Actions
if (contributor.hasActions(context)) {
actions.push(...contributor.getActions(context));
}
});
return actions;
}
getSecondaryActionBarActionsForContext(scope: string, context: any): IAction[] {
const actions: IAction[] = [];
// Go through contributors
this.getContributors(scope).forEach((contributor: ActionBarContributor) => {
// Secondary Actions
if (contributor.hasSecondaryActions(context)) {
actions.push(...contributor.getSecondaryActions(context));
}
});
return actions;
}
getActionItemForContext(scope: string, context: any, action: Action): BaseActionItem | null {
const contributors = this.getContributors(scope);
for (const contributor of contributors) {
const item = contributor.getActionItem(context, action);
if (item) {
return item;
}
}
return null;
}
registerActionBarContributor(scope: string, ctor: IConstructorSignature0<ActionBarContributor>): void {
if (!this.instantiationService) {
this.actionBarContributorConstructors.push({

View File

@@ -166,11 +166,11 @@ export abstract class Composite extends Component implements IComposite {
/**
* For any of the actions returned by this composite, provide an IActionItem in
* cases where the implementor of the composite wants to override the presentation
* of an action. Returns null to indicate that the action is not rendered through
* of an action. Returns undefined to indicate that the action is not rendered through
* an action item.
*/
getActionItem(action: IAction): IActionItem | null {
return null;
getActionItem(action: IAction): IActionItem | undefined {
return undefined;
}
/**

View File

@@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IDisposable, dispose, Disposable } from 'vs/base/common/lifecycle';
@@ -76,8 +76,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
private _container: HTMLElement = document.createElement('div');
get container(): HTMLElement { return this._container; }
get hasWorkbench(): boolean { return true; }
private parts: Map<string, Part> = new Map<string, Part>();
private workbenchGrid: Grid<View> | WorkbenchLegacyLayout;

View File

@@ -5,7 +5,7 @@
import { URI } from 'vs/base/common/uri';
import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
import { ITextSnapshot, IFileStat, IContent, IFileService, IResourceEncodings, IResolveFileOptions, IResolveFileResult, IResolveContentOptions, IStreamContent, IUpdateContentOptions, snapshotToString, ICreateFileOptions, IResourceEncoding } from 'vs/platform/files/common/files';
import { ITextSnapshot, IFileStat, IContent, IFileService, IResourceEncodings, IResolveFileOptions, IResolveFileResult, IResolveContentOptions, IStreamContent, IUpdateContentOptions, snapshotToString, ICreateFileOptions, IResourceEncoding, IFileStatWithMetadata } from 'vs/platform/files/common/files';
import { ITextBufferFactory } from 'vs/editor/common/model';
import { createTextBufferFactoryFromSnapshot } from 'vs/editor/common/model/textModel';
import { keys, ResourceMap } from 'vs/base/common/map';
@@ -60,6 +60,8 @@ import { ITextResourcePropertiesService } from 'vs/editor/common/services/resour
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { Color, RGBA } from 'vs/base/common/color';
import { IRemoteAgentEnvironment } from 'vs/platform/remote/common/remoteAgentEnvironment';
import { IRemoteAgentService, IRemoteAgentConnection } from 'vs/workbench/services/remote/common/remoteAgentService';
export const workspaceResource = URI.file(isWindows ? 'C:\\simpleWorkspace' : '/simpleWorkspace');
@@ -640,26 +642,19 @@ registerSingleton(IProductService, SimpleProductService, true);
//#region Remote Agent
export const IRemoteAgentService = createDecorator<IRemoteAgentService>('remoteAgentService');
export interface IRemoteAgentService {
_serviceBrand: any;
getConnection(): object;
}
export class SimpleRemoteAgentService implements IRemoteAgentService {
_serviceBrand: any;
getConnection(): object {
// @ts-ignore
return undefined;
getConnection(): IRemoteAgentConnection | null {
return null;
}
getEnvironment(): Promise<IRemoteAgentEnvironment | null> {
return Promise.resolve(null);
}
}
registerSingleton(IRemoteAgentService, SimpleRemoteAgentService);
//#endregion
//#region Remote Authority Resolver
@@ -699,7 +694,7 @@ export class SimpleRemoteFileService implements IFileService {
readonly onDidChangeFileSystemProviderRegistrations = Event.None;
readonly onWillActivateFileSystemProvider = Event.None;
resolveFile(resource: URI, options?: IResolveFileOptions): Promise<IFileStat> {
resolveFile(resource: URI, options?: IResolveFileOptions): Promise<IFileStatWithMetadata> {
// @ts-ignore
return Promise.resolve(fileMap.get(resource));
}
@@ -741,12 +736,14 @@ export class SimpleRemoteFileService implements IFileService {
// @ts-ignore
mtime: content.mtime,
// @ts-ignore
name: content.name
name: content.name,
// @ts-ignore
size: content.size
};
});
}
updateContent(resource: URI, value: string | ITextSnapshot, _options?: IUpdateContentOptions): Promise<IFileStat> {
updateContent(resource: URI, value: string | ITextSnapshot, _options?: IUpdateContentOptions): Promise<IFileStatWithMetadata> {
// @ts-ignore
return Promise.resolve(fileMap.get(resource)).then(file => {
const content = contentMap.get(resource);
@@ -763,7 +760,7 @@ export class SimpleRemoteFileService implements IFileService {
});
}
moveFile(_source: URI, _target: URI, _overwrite?: boolean): Promise<IFileStat> { return Promise.resolve(null!); }
moveFile(_source: URI, _target: URI, _overwrite?: boolean): Promise<IFileStatWithMetadata> { return Promise.resolve(null!); }
copyFile(_source: URI, _target: URI, _overwrite?: boolean): Promise<any> {
const parent = fileMap.get(dirname(_target));
@@ -776,7 +773,7 @@ export class SimpleRemoteFileService implements IFileService {
});
}
createFile(_resource: URI, _content?: string, _options?: ICreateFileOptions): Promise<IFileStat> {
createFile(_resource: URI, _content?: string, _options?: ICreateFileOptions): Promise<IFileStatWithMetadata> {
const parent = fileMap.get(dirname(_resource));
if (!parent) {
return Promise.reject(new Error(`Unable to create file in ${dirname(_resource).path}`));
@@ -785,7 +782,7 @@ export class SimpleRemoteFileService implements IFileService {
return Promise.resolve(createFile(parent, basename(_resource.path)));
}
createFolder(_resource: URI): Promise<IFileStat> {
createFolder(_resource: URI): Promise<IFileStatWithMetadata> {
const parent = fileMap.get(dirname(_resource));
if (!parent) {
return Promise.reject(new Error(`Unable to create folder in ${dirname(_resource).path}`));
@@ -794,7 +791,7 @@ export class SimpleRemoteFileService implements IFileService {
return Promise.resolve(createFolder(parent, basename(_resource.path)));
}
registerProvider(_scheme: string, _provider) { return { dispose() { } }; }
registerProvider() { return { dispose() { } }; }
activateProvider(_scheme: string): Promise<void> { return Promise.resolve(undefined); }
@@ -811,13 +808,14 @@ export class SimpleRemoteFileService implements IFileService {
dispose(): void { }
}
function createFile(parent: IFileStat, name: string, content: string = ''): IFileStat {
const file: IFileStat = {
function createFile(parent: IFileStat, name: string, content: string = ''): IFileStatWithMetadata {
const file: IFileStatWithMetadata = {
resource: joinPath(parent.resource, name),
etag: Date.now().toString(),
mtime: Date.now(),
isDirectory: false,
name
name,
size: -1
};
// @ts-ignore
@@ -837,13 +835,14 @@ function createFile(parent: IFileStat, name: string, content: string = ''): IFil
return file;
}
function createFolder(parent: IFileStat, name: string): IFileStat {
const folder: IFileStat = {
function createFolder(parent: IFileStat, name: string): IFileStatWithMetadata {
const folder: IFileStatWithMetadata = {
resource: joinPath(parent.resource, name),
etag: Date.now().toString(),
mtime: Date.now(),
isDirectory: true,
name,
size: 0,
children: []
};
@@ -863,7 +862,8 @@ function initFakeFileSystem(): void {
mtime: Date.now(),
isDirectory: true,
name: basename(workspaceResource.fsPath),
children: []
children: [],
size: 0
};
fileMap.set(root.resource, root);
@@ -1059,14 +1059,14 @@ export const IRequestService = createDecorator<IRequestService>('requestService'
export interface IRequestService {
_serviceBrand: any;
request(options, token: CancellationToken): Promise<object>;
request(options: any, token: CancellationToken): Promise<object>;
}
export class SimpleRequestService implements IRequestService {
_serviceBrand: any;
request(options, token: CancellationToken): Promise<object> {
request(options: any, token: CancellationToken): Promise<object> {
return Promise.resolve(Object.create(null));
}
}

View File

@@ -50,7 +50,7 @@ export class CompositeBar extends Widget implements ICompositeBar {
private compositeSwitcherBar: ActionBar;
private compositeOverflowAction: CompositeOverflowActivityAction | null;
private compositeOverflowActionItem: CompositeOverflowActivityActionItem | null;
private compositeOverflowActionItem: CompositeOverflowActivityActionItem | undefined;
private model: CompositeBarModel;
private visibleComposites: string[];
@@ -345,7 +345,7 @@ export class CompositeBar extends Widget implements ICompositeBar {
if (this.compositeOverflowActionItem) {
this.compositeOverflowActionItem.dispose();
}
this.compositeOverflowActionItem = null;
this.compositeOverflowActionItem = undefined;
}
// Pull out composites that overflow or got hidden

View File

@@ -432,14 +432,14 @@ export abstract class CompositePart<T extends Composite> extends Part {
this.titleLabel.updateStyles();
}
protected actionItemProvider(action: Action): IActionItem | null {
protected actionItemProvider(action: Action): IActionItem | undefined {
// Check Active Composite
if (this.activeComposite) {
return this.activeComposite.getActionItem(action);
}
return null;
return undefined;
}
protected actionsContextProvider(): any {

View File

@@ -114,9 +114,9 @@ class UntitledEditorInputFactory implements IEditorInputFactory {
@ITextFileService private readonly textFileService: ITextFileService
) { }
serialize(editorInput: EditorInput): string | null {
serialize(editorInput: EditorInput): string | undefined {
if (!this.textFileService.isHotExitEnabled) {
return null; // never restore untitled unless hot exit is enabled
return undefined; // never restore untitled unless hot exit is enabled
}
const untitledEditorInput = <UntitledEditorInput>editorInput;
@@ -170,7 +170,7 @@ interface ISerializedSideBySideEditorInput {
// Register Side by Side Editor Input Factory
class SideBySideEditorInputFactory implements IEditorInputFactory {
serialize(editorInput: EditorInput): string | null {
serialize(editorInput: EditorInput): string | undefined {
const input = <SideBySideEditorInput>editorInput;
if (input.details && input.master) {
@@ -195,10 +195,10 @@ class SideBySideEditorInputFactory implements IEditorInputFactory {
}
}
return null;
return undefined;
}
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): EditorInput | null {
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): EditorInput | undefined {
const deserialized: ISerializedSideBySideEditorInput = JSON.parse(serializedEditorInput);
const registry = Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactories);
@@ -214,7 +214,7 @@ class SideBySideEditorInputFactory implements IEditorInputFactory {
}
}
return null;
return undefined;
}
}

View File

@@ -39,7 +39,7 @@ import { Themable } from 'vs/workbench/common/theme';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
import { IFileService } from 'vs/platform/files/common/files';
import { withUndefinedAsNull } from 'vs/base/common/types';
import { withNullAsUndefined } from 'vs/base/common/types';
export interface IToolbarActions {
primary: IAction[];
@@ -156,18 +156,18 @@ export abstract class TitleControl extends Themable {
}));
}
private actionItemProvider(action: Action): IActionItem | null {
private actionItemProvider(action: Action): IActionItem | undefined {
const activeControl = this.group.activeControl;
// Check Active Editor
let actionItem: IActionItem | null = null;
let actionItem: IActionItem | undefined = undefined;
if (activeControl instanceof BaseEditor) {
actionItem = activeControl.getActionItem(action);
}
// Check extensions
if (!actionItem) {
actionItem = withUndefinedAsNull(createActionItem(action, this.keybindingService, this.notificationService, this.contextMenuService));
actionItem = createActionItem(action, this.keybindingService, this.notificationService, this.contextMenuService);
}
return actionItem;
@@ -323,7 +323,7 @@ export abstract class TitleControl extends Themable {
protected getKeybindingLabel(action: IAction): string | undefined {
const keybinding = this.getKeybinding(action);
return keybinding ? keybinding.getLabel() || undefined : undefined;
return keybinding ? withNullAsUndefined(keybinding.getLabel()) : undefined;
}
abstract openEditor(editor: IEditorInput): void;

View File

@@ -227,7 +227,7 @@ export class NotificationRenderer implements IListRenderer<INotificationViewItem
return item;
}
return null;
return undefined;
},
actionRunner: this.actionRunner
}

View File

@@ -30,7 +30,7 @@ import { Dimension, trackFocus } from 'vs/base/browser/dom';
import { localize } from 'vs/nls';
import { IDisposable } from 'vs/base/common/lifecycle';
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { isUndefinedOrNull } from 'vs/base/common/types';
import { isUndefinedOrNull, withUndefinedAsNull } from 'vs/base/common/types';
import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { LayoutPriority } from 'vs/base/browser/ui/grid/gridview';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
@@ -222,7 +222,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
}
}
return this.openComposite(id, focus) || null;
return withUndefinedAsNull(this.openComposite(id, focus));
}
showActivity(panelId: string, badge: IBadge, clazz?: string): IDisposable {

View File

@@ -309,7 +309,7 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
private static INPUT_BOX_ARIA_LABEL = localize('quickInputBox.ariaLabel', "Type to narrow down results.");
private _value = '';
private _placeholder;
private _placeholder: string;
private onDidChangeValueEmitter = new Emitter<string>();
private onDidAcceptEmitter = new Emitter<void>();
private _items: Array<T | IQuickPickSeparator> = [];
@@ -499,6 +499,7 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
if (this.canSelectMany) {
this.ui.list.domFocus();
}
event.preventDefault();
break;
case KeyCode.UpArrow:
if (this.ui.list.getFocusedElements().length) {
@@ -509,6 +510,7 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
if (this.canSelectMany) {
this.ui.list.domFocus();
}
event.preventDefault();
break;
case KeyCode.PageDown:
if (this.ui.list.getFocusedElements().length) {
@@ -519,6 +521,7 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
if (this.canSelectMany) {
this.ui.list.domFocus();
}
event.preventDefault();
break;
case KeyCode.PageUp:
if (this.ui.list.getFocusedElements().length) {
@@ -529,6 +532,7 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
if (this.canSelectMany) {
this.ui.list.domFocus();
}
event.preventDefault();
break;
}
}),

View File

@@ -28,6 +28,7 @@ import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { Action } from 'vs/base/common/actions';
import { getIconClass } from 'vs/workbench/browser/parts/quickinput/quickInputUtils';
import { IListOptions } from 'vs/base/browser/ui/list/listWidget';
import { withNullAsUndefined } from 'vs/base/common/types';
const $ = dom.$;
@@ -492,9 +493,9 @@ export class QuickInputList {
// Filter by value (since we support octicons, use octicon aware fuzzy matching)
else {
this.elements.forEach(element => {
const labelHighlights = this.matchOnLabel ? matchesFuzzyOcticonAware(query, parseOcticons(element.saneLabel)) || undefined : undefined;
const descriptionHighlights = this.matchOnDescription ? matchesFuzzyOcticonAware(query, parseOcticons(element.saneDescription || '')) || undefined : undefined;
const detailHighlights = this.matchOnDetail ? matchesFuzzyOcticonAware(query, parseOcticons(element.saneDetail || '')) || undefined : undefined;
const labelHighlights = this.matchOnLabel ? withNullAsUndefined(matchesFuzzyOcticonAware(query, parseOcticons(element.saneLabel))) : undefined;
const descriptionHighlights = this.matchOnDescription ? withNullAsUndefined(matchesFuzzyOcticonAware(query, parseOcticons(element.saneDescription || ''))) : undefined;
const detailHighlights = this.matchOnDetail ? withNullAsUndefined(matchesFuzzyOcticonAware(query, parseOcticons(element.saneDetail || ''))) : undefined;
if (labelHighlights || descriptionHighlights || detailHighlights) {
element.labelHighlights = labelHighlights;

View File

@@ -783,7 +783,7 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
}
getResource(): URI | null {
return this.resource || null;
return types.withUndefinedAsNull(this.resource);
}
getInput(): IEditorInput | IResourceInput {
@@ -848,7 +848,7 @@ export class RemoveFromEditorHistoryAction extends Action {
return <IHistoryPickEntry>{
input: h,
iconClasses: getIconClasses(this.modelService, this.modeService, entry.getResource() || undefined),
iconClasses: getIconClasses(this.modelService, this.modeService, types.withNullAsUndefined(entry.getResource())),
label: entry.getLabel(),
description: entry.getDescription()
};

View File

@@ -87,8 +87,8 @@ export class CustomTreeViewPanel extends ViewletPanel {
return [...this.treeView.getSecondaryActions()];
}
getActionItem(action: IAction): IActionItem | null {
return action instanceof MenuItemAction ? new ContextAwareMenuItemActionItem(action, this.keybindingService, this.notificationService, this.contextMenuService) : null;
getActionItem(action: IAction): IActionItem | undefined {
return action instanceof MenuItemAction ? new ContextAwareMenuItemActionItem(action, this.keybindingService, this.notificationService, this.contextMenuService) : undefined;
}
getOptimalWidth(): number {
@@ -378,7 +378,7 @@ export class CustomTreeView extends Disposable implements ITreeView {
}
private createTree() {
const actionItemProvider = (action: IAction) => action instanceof MenuItemAction ? this.instantiationService.createInstance(ContextAwareMenuItemActionItem, action) : null;
const actionItemProvider = (action: IAction) => action instanceof MenuItemAction ? this.instantiationService.createInstance(ContextAwareMenuItemActionItem, action) : undefined;
const menus = this._register(this.instantiationService.createInstance(TreeMenus, this.id));
this.treeLabels = this._register(this.instantiationService.createInstance(ResourceLabels, this));
const dataSource = this.instantiationService.createInstance(TreeDataSource, this, <T>(task: Promise<T>) => this.progressService.withProgress({ location: this.viewContainer.id }, () => task));
@@ -814,7 +814,7 @@ class TreeController extends WorkbenchTreeController {
if (keybinding) {
return new ActionItem(action, action, { label: true, keybinding: keybinding.getLabel() });
}
return null;
return undefined;
},
onHide: (wasCancelled?: boolean) => {

View File

@@ -174,8 +174,8 @@ export abstract class ViewletPanel extends Panel implements IView {
return [];
}
getActionItem(action: IAction): IActionItem | null {
return null;
getActionItem(action: IAction): IActionItem | undefined {
return undefined;
}
getActionsContext(): any {
@@ -282,7 +282,7 @@ export class PanelViewlet extends Viewlet {
return [];
}
getActionItem(action: IAction): IActionItem | null {
getActionItem(action: IAction): IActionItem | undefined {
if (this.isSingleView()) {
return this.panelItems[0].panel.getActionItem(action);
}

View File

@@ -214,7 +214,7 @@ class QuickOpenRegistry implements IQuickOpenRegistry {
}
getQuickOpenHandler(text: string): QuickOpenHandlerDescriptor | null {
return text ? arrays.first<QuickOpenHandlerDescriptor>(this.handlers, h => strings.startsWith(text, h.prefix), null) : null;
return text ? (arrays.first<QuickOpenHandlerDescriptor>(this.handlers, h => strings.startsWith(text, h.prefix)) || null) : null;
}
getDefaultQuickOpenHandler(): QuickOpenHandlerDescriptor {
@@ -280,7 +280,7 @@ export class EditorQuickOpenEntry extends QuickOpenEntry implements IEditorQuick
opts = EditorOptions.create(openOptions);
}
this.editorService.openEditor(input, opts || undefined, sideBySide ? SIDE_GROUP : ACTIVE_GROUP);
this.editorService.openEditor(input, types.withNullAsUndefined(opts), sideBySide ? SIDE_GROUP : ACTIVE_GROUP);
} else {
const resourceInput = <IResourceInput>input;

View File

@@ -82,7 +82,7 @@ export class Workbench extends Layout {
// Inform user about loading issues from the loader
(<any>window).require.config({
onError: err => {
onError: (err: { errorCode: string; }) => {
if (err.errorCode === 'load') {
onUnexpectedError(new Error(localize('loaderErrorNative', "Failed to load a required file. Please restart the application to try again. Details: {0}", JSON.stringify(err))));
}