mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-04-01 17:40:30 -04:00
Merge from vscode 011858832762aaff245b2336fb1c38166e7a10fb (#4663)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -227,7 +227,7 @@ export class NotificationRenderer implements IListRenderer<INotificationViewItem
|
||||
return item;
|
||||
}
|
||||
|
||||
return null;
|
||||
return undefined;
|
||||
},
|
||||
actionRunner: this.actionRunner
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}),
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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()
|
||||
};
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user