chore(vscode): update to 1.53.2

These conflicts will be resolved in the following commits. We do it this way so
that PR review is possible.
This commit is contained in:
Joe Previte
2021-02-25 11:27:27 -07:00
1900 changed files with 83066 additions and 64589 deletions

View File

@@ -128,5 +128,6 @@ Registry.add(Extensions.WorkbenchActions, new class implements IWorkbenchActionR
export const CATEGORIES = {
View: { value: localize('view', "View"), original: 'View' },
Help: { value: localize('help', "Help"), original: 'Help' },
Preferences: { value: localize('preferences', "Preferences"), original: 'Preferences' },
Developer: { value: localize({ key: 'developer', comment: ['A developer on Code itself or someone diagnosing issues in Code'] }, "Developer"), original: 'Developer' }
};

View File

@@ -18,6 +18,11 @@ export interface IComposite {
*/
readonly onDidBlur: Event<void>;
/**
* Returns true if the composite has focus.
*/
hasFocus(): boolean;
/**
* Returns the unique identifier of this composite.
*/

View File

@@ -18,6 +18,7 @@ export interface IDialogHandle {
}
export interface IDialogsModel {
readonly onDidShowDialog: Event<void>;
readonly dialogs: IDialogViewItem[];
@@ -26,6 +27,7 @@ export interface IDialogsModel {
}
export class DialogsModel extends Disposable implements IDialogsModel {
readonly dialogs: IDialogViewItem[] = [];
private readonly _onDidShowDialog = this._register(new Emitter<void>());

View File

@@ -74,7 +74,7 @@ export interface IEditorPane extends IComposite {
/**
* The assigned options of the editor.
*/
readonly options: EditorOptions | undefined;
readonly options: IEditorOptions | undefined;
/**
* The assigned group this editor is showing in.
@@ -1215,7 +1215,7 @@ export interface IEditorOpenContext {
* An editor is new for a group if it was not part of the group before and
* otherwise was already opened in the group and just became the active editor.
*
* This hint can e.g. be used to decide wether to restore view state or not.
* This hint can e.g. be used to decide whether to restore view state or not.
*/
newInGroup?: boolean;
}
@@ -1257,14 +1257,15 @@ export interface IEditorCloseEvent extends IEditorIdentifier {
export type GroupIdentifier = number;
export interface IWorkbenchEditorConfiguration {
workbench: {
editor: IEditorPartConfiguration,
iconTheme: string;
workbench?: {
editor?: IEditorPartConfiguration,
iconTheme?: string;
};
}
interface IEditorPartConfiguration {
showTabs?: boolean;
wrapTabs?: boolean;
scrollToSwitchTabs?: boolean;
highlightModifiedTabs?: boolean;
tabCloseButton?: 'left' | 'right' | 'off';
@@ -1275,6 +1276,7 @@ interface IEditorPartConfiguration {
showIcons?: boolean;
enablePreview?: boolean;
enablePreviewFromQuickOpen?: boolean;
enablePreviewFromCodeNavigation?: boolean;
closeOnFileDelete?: boolean;
openPositioning?: 'left' | 'right' | 'first' | 'last';
openSideBySideDirection?: 'right' | 'down';
@@ -1290,6 +1292,10 @@ interface IEditorPartConfiguration {
value?: number;
perEditorGroup?: boolean;
};
decorations?: {
badges?: boolean;
colors?: boolean;
}
}
export interface IEditorPartOptions extends IEditorPartConfiguration {
@@ -1328,7 +1334,9 @@ class EditorResourceAccessorImpl {
/**
* The original URI of an editor is the URI that was used originally to open
* the editor and should be used whenever the URI is presented to the user,
* e.g. as a label.
* e.g. as a label together with utility methods such as `ResourceLabel` or
* `ILabelService` that can turn this original URI into the best form for
* presenting.
*
* In contrast, the canonical URI (#getCanonicalUri) may be different and should
* be used whenever the URI is used to e.g. compare with other editors or when

View File

@@ -13,6 +13,7 @@ import { dirname } from 'vs/base/common/resources';
import { ILabelService } from 'vs/platform/label/common/label';
import { IFileService } from 'vs/platform/files/common/files';
import { URI } from 'vs/base/common/uri';
import { withNullAsUndefined } from 'vs/base/common/types';
/**
* The base editor input for the diff editor. It is made up of two editor inputs, the original version
@@ -110,21 +111,18 @@ export class DiffEditorInput extends SideBySideEditorInput {
private async createModel(): Promise<DiffEditorModel> {
// Join resolve call over two inputs and build diff editor model
const models = await Promise.all([
const [originalEditorModel, modifiedEditorModel] = await Promise.all([
this.originalInput.resolve(),
this.modifiedInput.resolve()
]);
const originalEditorModel = models[0];
const modifiedEditorModel = models[1];
// If both are text models, return textdiffeditor model
if (modifiedEditorModel instanceof BaseTextEditorModel && originalEditorModel instanceof BaseTextEditorModel) {
return new TextDiffEditorModel(originalEditorModel, modifiedEditorModel);
}
// Otherwise return normal diff model
return new DiffEditorModel(originalEditorModel, modifiedEditorModel);
return new DiffEditorModel(withNullAsUndefined(originalEditorModel), withNullAsUndefined(modifiedEditorModel));
}
matches(otherInput: unknown): boolean {

View File

@@ -12,13 +12,13 @@ import { IEditorModel } from 'vs/platform/editor/common/editor';
*/
export class DiffEditorModel extends EditorModel {
protected readonly _originalModel: IEditorModel | null;
get originalModel(): IEditorModel | null { return this._originalModel; }
protected readonly _originalModel: IEditorModel | undefined;
get originalModel(): IEditorModel | undefined { return this._originalModel; }
protected readonly _modifiedModel: IEditorModel | null;
get modifiedModel(): IEditorModel | null { return this._modifiedModel; }
protected readonly _modifiedModel: IEditorModel | undefined;
get modifiedModel(): IEditorModel | undefined { return this._modifiedModel; }
constructor(originalModel: IEditorModel | null, modifiedModel: IEditorModel | null) {
constructor(originalModel: IEditorModel | undefined, modifiedModel: IEditorModel | undefined) {
super();
this._originalModel = originalModel;
@@ -28,7 +28,7 @@ export class DiffEditorModel extends EditorModel {
async load(): Promise<EditorModel> {
await Promise.all([
this._originalModel?.load(),
this._modifiedModel?.load(),
this._modifiedModel?.load()
]);
return this;

View File

@@ -724,12 +724,19 @@ export class EditorGroup extends Disposable {
clone(): EditorGroup {
const group = this.instantiationService.createInstance(EditorGroup, undefined);
// Copy over group properties
group.editors = this.editors.slice(0);
group.mru = this.mru.slice(0);
group.preview = this.preview;
group.active = this.active;
group.sticky = this.sticky;
// Ensure to register listeners for each editor
for (const editor of group.editors) {
group.registerEditorListeners(editor);
}
return group;
}

View File

@@ -97,7 +97,7 @@ export class ResourceEditorInput extends AbstractTextResourceEditorInput impleme
ref.dispose();
this.modelReference = undefined;
throw new Error(`Unexpected model for ResourcEditorInput: ${this.resource}`);
throw new Error(`Unexpected model for ResourceEditorInput: ${this.resource}`);
}
this.cachedModel = model;

View File

@@ -23,7 +23,7 @@ export class ResourceEditorModel extends BaseTextEditorModel {
dispose(): void {
// TODO@Joao: force this class to dispose the underlying model
// force this class to dispose the underlying model
if (this.textEditorModelHandle) {
this.modelService.destroyModel(this.textEditorModelHandle);
}

View File

@@ -14,14 +14,14 @@ import { DiffEditorModel } from 'vs/workbench/common/editor/diffEditorModel';
*/
export class TextDiffEditorModel extends DiffEditorModel {
protected readonly _originalModel: BaseTextEditorModel | null;
get originalModel(): BaseTextEditorModel | null { return this._originalModel; }
protected readonly _originalModel: BaseTextEditorModel | undefined;
get originalModel(): BaseTextEditorModel | undefined { return this._originalModel; }
protected readonly _modifiedModel: BaseTextEditorModel | null;
get modifiedModel(): BaseTextEditorModel | null { return this._modifiedModel; }
protected readonly _modifiedModel: BaseTextEditorModel | undefined;
get modifiedModel(): BaseTextEditorModel | undefined { return this._modifiedModel; }
private _textDiffEditorModel: IDiffEditorModel | null = null;
get textDiffEditorModel(): IDiffEditorModel | null { return this._textDiffEditorModel; }
private _textDiffEditorModel: IDiffEditorModel | undefined = undefined;
get textDiffEditorModel(): IDiffEditorModel | undefined { return this._textDiffEditorModel; }
constructor(originalModel: BaseTextEditorModel, modifiedModel: BaseTextEditorModel) {
super(originalModel, modifiedModel);
@@ -73,7 +73,7 @@ export class TextDiffEditorModel extends DiffEditorModel {
// inside. We never created the two models (original and modified) so we can not dispose
// them without sideeffects. Rather rely on the models getting disposed when their related
// inputs get disposed from the diffEditorInput.
this._textDiffEditorModel = null;
this._textDiffEditorModel = undefined;
super.dispose();
}

View File

@@ -18,7 +18,7 @@ import { withUndefinedAsNull } from 'vs/base/common/types';
*/
export class BaseTextEditorModel extends EditorModel implements ITextEditorModel, IModeSupport {
protected textEditorModelHandle: URI | null = null;
protected textEditorModelHandle: URI | undefined = undefined;
private createdEditorModel: boolean | undefined;
@@ -52,7 +52,7 @@ export class BaseTextEditorModel extends EditorModel implements ITextEditorModel
private registerModelDisposeListener(model: ITextModel): void {
this.modelDisposeListener.value = model.onWillDispose(() => {
this.textEditorModelHandle = null; // make sure we do not dispose code editor model again
this.textEditorModelHandle = undefined; // make sure we do not dispose code editor model again
this.dispose();
});
}
@@ -178,7 +178,7 @@ export class BaseTextEditorModel extends EditorModel implements ITextEditorModel
this.modelService.destroyModel(this.textEditorModelHandle);
}
this.textEditorModelHandle = null;
this.textEditorModelHandle = undefined;
this.createdEditorModel = false;
super.dispose();

View File

@@ -199,14 +199,14 @@ export abstract class AbstractTextResourceEditorInput extends EditorInput implem
}
// Normal save
return this.doSave(group, options, false);
return this.doSave(options, false);
}
saveAs(group: GroupIdentifier, options?: ITextFileSaveOptions): Promise<IEditorInput | undefined> {
return this.doSave(group, options, true);
return this.doSave(options, true);
}
private async doSave(group: GroupIdentifier, options: ISaveOptions | undefined, saveAs: boolean): Promise<IEditorInput | undefined> {
private async doSave(options: ISaveOptions | undefined, saveAs: boolean): Promise<IEditorInput | undefined> {
// Save / Save As
let target: URI | undefined;
@@ -220,8 +220,13 @@ export abstract class AbstractTextResourceEditorInput extends EditorInput implem
return undefined; // save cancelled
}
// If the target is a different resource, return with a new editor input
if (!isEqual(target, this.preferredResource)) {
// If this save operation results in a new editor, either
// because it was saved to disk (e.g. from untitled) or
// through an explicit "Save As", make sure to replace it.
if (
target.scheme !== this.resource.scheme ||
(saveAs && !isEqual(target, this.preferredResource))
) {
return this.editorService.createEditorInput({ resource: target });
}

View File

@@ -9,5 +9,7 @@ import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
export const ActivePanelContext = new RawContextKey<string>('activePanel', '');
export const PanelFocusContext = new RawContextKey<boolean>('panelFocus', false);
export const PanelPositionContext = new RawContextKey<string>('panelPosition', 'bottom');
export const PanelVisibleContext = new RawContextKey<boolean>('panelVisible', false);
export const PanelMaximizedContext = new RawContextKey<boolean>('panelMaximized', false);
export interface IPanel extends IComposite { }

View File

@@ -339,7 +339,7 @@ export const STATUS_BAR_FOREGROUND = registerColor('statusBar.foreground', {
dark: '#FFFFFF',
light: '#FFFFFF',
hc: '#FFFFFF'
}, nls.localize('statusBarForeground', "Status bar foreground color when a workspace is opened. The status bar is shown in the bottom of the window."));
}, nls.localize('statusBarForeground', "Status bar foreground color when a workspace or folder is opened. The status bar is shown in the bottom of the window."));
export const STATUS_BAR_NO_FOLDER_FOREGROUND = registerColor('statusBar.noFolderForeground', {
dark: STATUS_BAR_FOREGROUND,
@@ -351,7 +351,7 @@ export const STATUS_BAR_BACKGROUND = registerColor('statusBar.background', {
dark: '#007ACC',
light: '#007ACC',
hc: null
}, nls.localize('statusBarBackground', "Status bar background color when a workspace is opened. The status bar is shown in the bottom of the window."));
}, nls.localize('statusBarBackground', "Status bar background color when a workspace or folder is opened. The status bar is shown in the bottom of the window."));
export const STATUS_BAR_NO_FOLDER_BACKGROUND = registerColor('statusBar.noFolderBackground', {
dark: '#68217A',

View File

@@ -27,9 +27,7 @@ import { IMarkdownString } from 'vs/base/common/htmlContent';
import { mixin } from 'vs/base/common/objects';
import { Codicon } from 'vs/base/common/codicons';
import { registerIcon } from 'vs/platform/theme/common/iconRegistry';
export const TEST_VIEW_CONTAINER_ID = 'workbench.view.extension.test';
export const testViewIcon = registerIcon('test-view-icon', Codicon.beaker, localize('testViewIcon', 'View icon of the test view.'));
import { CancellationToken } from 'vs/base/common/cancellation';
export const defaultViewIcon = registerIcon('default-view-icon', Codicon.window, localize('defaultViewIcon', 'Default view icon.'));
@@ -38,11 +36,18 @@ export namespace Extensions {
export const ViewsRegistry = 'workbench.registry.view';
}
export enum ViewContainerLocation {
export const enum ViewContainerLocation {
Sidebar,
Panel
}
export function ViewContainerLocationToString(viewContainerLocation: ViewContainerLocation) {
switch (viewContainerLocation) {
case ViewContainerLocation.Sidebar: return 'sidebar';
case ViewContainerLocation.Panel: return 'panel';
}
}
export interface IViewContainerDescriptor {
readonly id: string;
@@ -256,6 +261,8 @@ export interface IAddedViewDescriptorState {
export interface IViewContainerModel {
readonly viewContainer: ViewContainer;
readonly title: string;
readonly icon: ThemeIcon | URI | undefined;
readonly onDidChangeContainerInfo: Event<{ title?: boolean, icon?: boolean }>;
@@ -505,7 +512,7 @@ export interface IViewsService {
* View Contexts
*/
export const FocusedViewContext = new RawContextKey<string>('focusedView', '');
export function getVisbileViewContextKey(viewId: string): string { return `${viewId}.visible`; }
export function getVisbileViewContextKey(viewId: string): string { return `view.${viewId}.visible`; }
export const IViewDescriptorService = createDecorator<IViewDescriptorService>('viewDescriptorService');
@@ -684,21 +691,24 @@ export class ResolvableTreeItem implements ITreeItem {
command?: Command;
children?: ITreeItem[];
accessibilityInformation?: IAccessibilityInformation;
resolve: () => Promise<void>;
resolve: (token: CancellationToken) => Promise<void>;
private resolved: boolean = false;
private _hasResolve: boolean = false;
constructor(treeItem: ITreeItem, resolve?: (() => Promise<ITreeItem | undefined>)) {
constructor(treeItem: ITreeItem, resolve?: ((token: CancellationToken) => Promise<ITreeItem | undefined>)) {
mixin(this, treeItem);
this._hasResolve = !!resolve;
this.resolve = async () => {
this.resolve = async (token: CancellationToken) => {
if (resolve && !this.resolved) {
const resolvedItem = await resolve();
const resolvedItem = await resolve(token);
if (resolvedItem) {
// Resolvable elements. Currently only tooltip.
this.tooltip = resolvedItem.tooltip;
// Resolvable elements. Currently tooltip and command.
this.tooltip = this.tooltip ?? resolvedItem.tooltip;
this.command = this.command ?? resolvedItem.command;
}
}
this.resolved = true;
if (!token.isCancellationRequested) {
this.resolved = true;
}
};
}
get hasResolve(): boolean {
@@ -756,5 +766,6 @@ export interface IViewPaneContainer {
getActionViewItem(action: IAction): IActionViewItem | undefined;
getActionsContext(): unknown;
getView(viewId: string): IView | undefined;
toggleViewVisibility(viewId: string): void;
saveState(): void;
}