Merge from vscode fc10e26ea50f82cdd84e9141491357922e6f5fba (#4639)

This commit is contained in:
Anthony Dresser
2019-03-21 10:58:16 -07:00
committed by GitHub
parent 8298db7d13
commit b65ee5b42e
149 changed files with 1408 additions and 814 deletions

View File

@@ -288,7 +288,9 @@ export class SimpleExtensionGalleryService implements IExtensionGalleryService {
return false;
}
query(options?: IQueryOptions): Promise<IPager<IGalleryExtension>> {
query(token: CancellationToken): Promise<IPager<IGalleryExtension>>;
query(options: IQueryOptions, token: CancellationToken): Promise<IPager<IGalleryExtension>>;
query(arg1: any, arg2?: any): Promise<IPager<IGalleryExtension>> {
// @ts-ignore
return Promise.resolve(undefined);
}

View File

@@ -28,7 +28,7 @@ export class BinaryResourceDiffEditor extends SideBySideEditor {
super(telemetryService, instantiationService, themeService, storageService);
}
getMetadata(): string | null {
getMetadata(): string | undefined {
const master = this.masterEditor;
const details = this.detailsEditor;
@@ -36,6 +36,6 @@ export class BinaryResourceDiffEditor extends SideBySideEditor {
return nls.localize('metadataDiff', "{0} ↔ {1}", details.getMetadata(), master.getMetadata());
}
return null;
return undefined;
}
}

View File

@@ -37,7 +37,7 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor {
get onDidOpenInPlace(): Event<void> { return this._onDidOpenInPlace.event; }
private callbacks: IOpenCallbacks;
private metadata: string | null;
private metadata: string | undefined;
private binaryContainer: HTMLElement;
private scrollbar: DomScrollableElement;
private resourceViewerContext: ResourceViewerContext;
@@ -110,20 +110,20 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor {
});
}
private handleMetadataChanged(meta: string | null): void {
private handleMetadataChanged(meta: string | undefined): void {
this.metadata = meta;
this._onMetadataChanged.fire();
}
getMetadata() {
getMetadata(): string | undefined {
return this.metadata;
}
clearInput(): void {
// Clear Meta
this.handleMetadataChanged(null);
this.handleMetadataChanged(undefined);
// Clear Resource Viewer
clearNode(this.binaryContainer);

View File

@@ -143,43 +143,35 @@ interface StateDelta {
indentation?: string;
tabFocusMode?: boolean;
screenReaderMode?: boolean;
metadata?: string | null;
metadata?: string | undefined;
}
class State {
private _selectionStatus: string | null | undefined;
get selectionStatus(): string | null | undefined { return this._selectionStatus; }
private _selectionStatus: string | undefined;
get selectionStatus(): string | undefined { return this._selectionStatus; }
private _mode: string | null | undefined;
get mode(): string | null | undefined { return this._mode; }
private _mode: string | undefined;
get mode(): string | undefined { return this._mode; }
private _encoding: string | null | undefined;
get encoding(): string | null | undefined { return this._encoding; }
private _encoding: string | undefined;
get encoding(): string | undefined { return this._encoding; }
private _EOL: string | null | undefined;
get EOL(): string | null | undefined { return this._EOL; }
private _EOL: string | undefined;
get EOL(): string | undefined { return this._EOL; }
private _indentation: string | null | undefined;
get indentation(): string | null | undefined { return this._indentation; }
private _indentation: string | undefined;
get indentation(): string | undefined { return this._indentation; }
private _tabFocusMode: boolean | null | undefined;
get tabFocusMode(): boolean | null | undefined { return this._tabFocusMode; }
private _tabFocusMode: boolean | undefined;
get tabFocusMode(): boolean | undefined { return this._tabFocusMode; }
private _screenReaderMode: boolean | null | undefined;
get screenReaderMode(): boolean | null | undefined { return this._screenReaderMode; }
private _screenReaderMode: boolean | undefined;
get screenReaderMode(): boolean | undefined { return this._screenReaderMode; }
private _metadata: string | null | undefined;
get metadata(): string | null | undefined { return this._metadata; }
private _metadata: string | undefined;
get metadata(): string | undefined { return this._metadata; }
constructor() {
this._selectionStatus = null;
this._mode = null;
this._encoding = null;
this._EOL = null;
this._tabFocusMode = false;
this._screenReaderMode = false;
this._metadata = null;
}
constructor() { }
update(update: StateDelta): StateChange {
const change = new StateChange();

View File

@@ -6,7 +6,7 @@
import 'vs/css!./media/statusbarpart';
import * as nls from 'vs/nls';
import { toErrorMessage } from 'vs/base/common/errorMessage';
import { dispose, IDisposable, toDisposable, combinedDisposable } from 'vs/base/common/lifecycle';
import { dispose, IDisposable, toDisposable, combinedDisposable, Disposable } from 'vs/base/common/lifecycle';
import { OcticonLabel } from 'vs/base/browser/ui/octiconLabel/octiconLabel';
import { Registry } from 'vs/platform/registry/common/platform';
import { ICommandService } from 'vs/platform/commands/common/commands';
@@ -49,6 +49,8 @@ export class StatusbarPart extends Part implements IStatusbarService {
private statusMsgDispose: IDisposable;
private styleElement: HTMLStyleElement;
private pendingEntries: { entry: IStatusbarEntry, alignment: StatusbarAlignment, priority: number, disposable: IDisposable }[] = [];
constructor(
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IThemeService themeService: IThemeService,
@@ -67,6 +69,18 @@ export class StatusbarPart extends Part implements IStatusbarService {
addEntry(entry: IStatusbarEntry, alignment: StatusbarAlignment, priority: number = 0): IDisposable {
// As long as we have not been created into a container yet, record all entries
// that are pending so that they can get created at a later point
if (!this.element) {
const pendingEntry = { entry, alignment, priority, disposable: Disposable.None };
this.pendingEntries.push(pendingEntry);
return toDisposable(() => {
this.pendingEntries = this.pendingEntries.filter(e => e !== pendingEntry);
pendingEntry.disposable.dispose();
});
}
// Render entry in status bar
const el = this.doCreateStatusItem(alignment, priority, entry.showBeak ? 'has-beak' : undefined);
const item = this.instantiationService.createInstance(StatusBarEntryItem, entry);
@@ -146,6 +160,14 @@ export class StatusbarPart extends Part implements IStatusbarService {
this.element.appendChild(el);
}
// Fill in pending entries if any
while (this.pendingEntries.length) {
const entry = this.pendingEntries.shift();
if (entry) {
entry.disposable = this.addEntry(entry.entry, entry.alignment, entry.priority);
}
}
return this.element;
}

View File

@@ -123,6 +123,9 @@ export class MenubarControl extends Disposable {
this.menuUpdater = this._register(new RunOnceScheduler(() => this.doUpdateMenubar(false), 200));
this._onVisibilityChange = this._register(new Emitter<boolean>());
this._onFocusStateChange = this._register(new Emitter<boolean>());
if (isMacintosh || this.currentTitlebarStyleSetting !== 'custom') {
for (const topLevelMenuName of Object.keys(this.topLevelMenus)) {
const menu = this.topLevelMenus[topLevelMenuName];
@@ -130,15 +133,14 @@ export class MenubarControl extends Disposable {
this._register(menu.onDidChange(() => this.updateMenubar()));
}
}
this.doUpdateMenubar(true);
}
this._onVisibilityChange = this._register(new Emitter<boolean>());
this._onFocusStateChange = this._register(new Emitter<boolean>());
this.windowService.getRecentlyOpened().then((recentlyOpened) => {
this.recentlyOpened = recentlyOpened;
if (isMacintosh || this.currentTitlebarStyleSetting !== 'custom') {
this.doUpdateMenubar(true);
}
});
this.notifyExistingLinuxUser();

View File

@@ -179,7 +179,7 @@ export class TitlebarPart extends Part implements ITitleService {
}
private updateRepresentedFilename(): void {
const file = toResource(this.editorService.activeEditor || null, { supportSideBySide: true, filter: 'file' });
const file = toResource(this.editorService.activeEditor, { supportSideBySide: true, filter: 'file' });
const path = file ? file.fsPath : '';
// Apply to window
@@ -282,7 +282,7 @@ export class TitlebarPart extends Part implements ITitleService {
// Compute folder resource
// Single Root Workspace: always the root single workspace in this case
// Otherwise: root folder of the currently active file if any
const folder = this.contextService.getWorkbenchState() === WorkbenchState.FOLDER ? workspace.folders[0] : this.contextService.getWorkspaceFolder(toResource(editor || null, { supportSideBySide: true })!);
const folder = this.contextService.getWorkbenchState() === WorkbenchState.FOLDER ? workspace.folders[0] : this.contextService.getWorkspaceFolder(toResource(editor, { supportSideBySide: true })!);
// Variables
const activeEditorShort = editor ? editor.getTitle(Verbosity.SHORT) : '';