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

@@ -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;