Update to VS Code 1.52.1

This commit is contained in:
Asher
2021-02-09 16:08:37 +00:00
1351 changed files with 56560 additions and 38990 deletions

View File

@@ -5,7 +5,7 @@
import { Memento, MementoObject } from 'vs/workbench/common/memento';
import { IThemeService, Themable } from 'vs/platform/theme/common/themeService';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
export class Component extends Themable {
@@ -35,8 +35,8 @@ export class Component extends Themable {
return this.id;
}
protected getMemento(scope: StorageScope): MementoObject {
return this.memento.getMemento(scope);
protected getMemento(scope: StorageScope, target: StorageTarget): MementoObject {
return this.memento.getMemento(scope, target);
}
protected saveState(): void {

View File

@@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Event, Emitter } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
import { IDialog, IDialogResult } from 'vs/platform/dialogs/common/dialogs';
export interface IDialogViewItem {
args: IDialog;
close(result?: IDialogResult): void;
}
export interface IDialogHandle {
item: IDialogViewItem;
result: Promise<IDialogResult | undefined>;
}
export interface IDialogsModel {
readonly onDidShowDialog: Event<void>;
readonly dialogs: IDialogViewItem[];
show(dialog: IDialog): IDialogHandle;
}
export class DialogsModel extends Disposable implements IDialogsModel {
readonly dialogs: IDialogViewItem[] = [];
private readonly _onDidShowDialog = this._register(new Emitter<void>());
readonly onDidShowDialog = this._onDidShowDialog.event;
show(dialog: IDialog): IDialogHandle {
let resolver: (value?: IDialogResult) => void;
const item: IDialogViewItem = {
args: dialog,
close: (result) => { this.dialogs.splice(0, 1); resolver(result); }
};
this.dialogs.push(item);
this._onDidShowDialog.fire();
return {
item,
result: new Promise(resolve => { resolver = resolve; })
};
}
}

View File

@@ -14,13 +14,13 @@ import { IInstantiationService, IConstructorSignature0, ServicesAccessor, Brande
import { IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { Registry } from 'vs/platform/registry/common/platform';
import { ITextModel } from 'vs/editor/common/model';
import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService';
import { GroupsOrder, IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { ICompositeControl, IComposite } from 'vs/workbench/common/composite';
import { ActionRunner, IAction } from 'vs/base/common/actions';
import { IFileService } from 'vs/platform/files/common/files';
import { IPathData } from 'vs/platform/windows/common/windows';
import { coalesce, firstOrDefault } from 'vs/base/common/arrays';
import { IResourceEditorInputType } from 'vs/workbench/services/editor/common/editorService';
import { ACTIVE_GROUP, IResourceEditorInputType, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService';
import { IRange } from 'vs/editor/common/core/range';
import { IExtUri } from 'vs/base/common/resources';
@@ -178,7 +178,7 @@ export interface IFileEditorInputFactory {
/**
* Creates new new editor input capable of showing files.
*/
createFileEditorInput(resource: URI, preferredResource: URI | undefined, encoding: string | undefined, mode: string | undefined, instantiationService: IInstantiationService): IFileEditorInput;
createFileEditorInput(resource: URI, preferredResource: URI | undefined, preferredName: string | undefined, preferredDescription: string | undefined, preferredEncoding: string | undefined, preferredMode: string | undefined, instantiationService: IInstantiationService): IFileEditorInput;
/**
* Check if the provided object is a file editor input.
@@ -704,6 +704,24 @@ export interface IFileEditorInput extends IEditorInput, IEncodingSupport, IModeS
*/
setPreferredResource(preferredResource: URI): void;
/**
* Sets the preferred name to use for this file input.
*
* Note: for certain file schemes the input may decide to ignore this
* name and use our standard naming. Specifically for schemes we own,
* we do not let others override the name.
*/
setPreferredName(name: string): void;
/**
* Sets the preferred description to use for this file input.
*
* Note: for certain file schemes the input may decide to ignore this
* description and use our standard naming. Specifically for schemes we own,
* we do not let others override the description.
*/
setPreferredDescription(description: string): void;
/**
* Sets the preferred encoding to use for this file input.
*/
@@ -734,7 +752,7 @@ export class SideBySideEditorInput extends EditorInput {
constructor(
protected readonly name: string | undefined,
private readonly description: string | undefined,
protected readonly description: string | undefined,
private readonly _secondary: EditorInput,
private readonly _primary: EditorInput
) {
@@ -1266,6 +1284,7 @@ interface IEditorPartConfiguration {
labelFormat?: 'default' | 'short' | 'medium' | 'long';
restoreViewState?: boolean;
splitSizing?: 'split' | 'distribute';
splitOnDragAndDrop?: boolean;
limit?: {
enabled?: boolean;
value?: number;
@@ -1421,13 +1440,15 @@ export const enum CloseDirection {
export interface IEditorMemento<T> {
saveEditorState(group: IEditorGroup, resource: URI, state: T): void;
saveEditorState(group: IEditorGroup, editor: EditorInput, state: T): void;
saveEditorState(group: IEditorGroup, editor: IEditorInput, state: T): void;
loadEditorState(group: IEditorGroup, resource: URI): T | undefined;
loadEditorState(group: IEditorGroup, editor: EditorInput): T | undefined;
loadEditorState(group: IEditorGroup, editor: IEditorInput): T | undefined;
clearEditorState(resource: URI, group?: IEditorGroup): void;
clearEditorState(editor: EditorInput, group?: IEditorGroup): void;
clearEditorState(editor: IEditorInput, group?: IEditorGroup): void;
clearEditorStateOnDispose(resource: URI, editor: IEditorInput): void;
moveEditorState(source: URI, target: URI, comparer: IExtUri): void;
}
@@ -1569,3 +1590,42 @@ export function computeEditorAriaLabel(input: IEditorInput, index: number | unde
return ariaLabel;
}
//#region Editor Group Column
/**
* A way to address editor groups through a column based system
* where `0` is the first column. Will fallback to `SIDE_GROUP`
* in case the column does not exist yet.
*/
export type EditorGroupColumn = number;
export function viewColumnToEditorGroup(editorGroupService: IEditorGroupsService, viewColumn?: EditorGroupColumn): GroupIdentifier {
if (typeof viewColumn !== 'number' || viewColumn === ACTIVE_GROUP) {
return ACTIVE_GROUP; // prefer active group when position is undefined or passed in as such
}
const groups = editorGroupService.getGroups(GroupsOrder.GRID_APPEARANCE);
let candidateGroup = groups[viewColumn];
if (candidateGroup) {
return candidateGroup.id; // found direct match
}
let firstGroup = groups[0];
if (groups.length === 1 && firstGroup.count === 0) {
return firstGroup.id; // first editor should always open in first group independent from position provided
}
return SIDE_GROUP; // open to the side if group not found or we are instructed to
}
export function editorGroupToViewColumn(editorGroupService: IEditorGroupsService, editorGroup: IEditorGroup | GroupIdentifier): EditorGroupColumn {
let group = (typeof editorGroup === 'number') ? editorGroupService.getGroup(editorGroup) : editorGroup;
group = group ?? editorGroupService.activeGroup;
return editorGroupService.getGroups(GroupsOrder.GRID_APPEARANCE).indexOf(group);
}
//#endregion

View File

@@ -3,11 +3,16 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { EditorModel, EditorInput, SideBySideEditorInput, TEXT_DIFF_EDITOR_ID, BINARY_DIFF_EDITOR_ID } from 'vs/workbench/common/editor';
import { EditorModel, EditorInput, SideBySideEditorInput, TEXT_DIFF_EDITOR_ID, BINARY_DIFF_EDITOR_ID, Verbosity } from 'vs/workbench/common/editor';
import { BaseTextEditorModel } from 'vs/workbench/common/editor/textEditorModel';
import { DiffEditorModel } from 'vs/workbench/common/editor/diffEditorModel';
import { TextDiffEditorModel } from 'vs/workbench/common/editor/textDiffEditorModel';
import { localize } from 'vs/nls';
import { AbstractTextResourceEditorInput } from 'vs/workbench/common/editor/textResourceEditorInput';
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';
/**
* The base editor input for the diff editor. It is made up of two editor inputs, the original version
@@ -21,10 +26,12 @@ export class DiffEditorInput extends SideBySideEditorInput {
constructor(
protected name: string | undefined,
description: string | undefined,
protected description: string | undefined,
public readonly originalInput: EditorInput,
public readonly modifiedInput: EditorInput,
private readonly forceOpenAsBinary?: boolean
private readonly forceOpenAsBinary: boolean | undefined,
@ILabelService private readonly labelService: ILabelService,
@IFileService private readonly fileService: IFileService
) {
super(name, description, originalInput, modifiedInput);
}
@@ -35,12 +42,51 @@ export class DiffEditorInput extends SideBySideEditorInput {
getName(): string {
if (!this.name) {
// Craft a name from original and modified input that includes the
// relative path in case both sides have different parents and we
// compare file resources.
const fileResources = this.asFileResources();
if (fileResources && dirname(fileResources.original).path !== dirname(fileResources.modified).path) {
return `${this.labelService.getUriLabel(fileResources.original, { relative: true })} ↔ ${this.labelService.getUriLabel(fileResources.modified, { relative: true })}`;
}
return localize('sideBySideLabels', "{0} ↔ {1}", this.originalInput.getName(), this.modifiedInput.getName());
}
return this.name;
}
getDescription(verbosity: Verbosity = Verbosity.MEDIUM): string | undefined {
if (typeof this.description !== 'string') {
// Pass the description of the modified side in case both original
// and modified input have the same parent and we compare file resources.
const fileResources = this.asFileResources();
if (fileResources && dirname(fileResources.original).path === dirname(fileResources.modified).path) {
return this.modifiedInput.getDescription(verbosity);
}
}
return this.description;
}
private asFileResources(): { original: URI, modified: URI } | undefined {
if (
this.originalInput instanceof AbstractTextResourceEditorInput &&
this.modifiedInput instanceof AbstractTextResourceEditorInput &&
this.fileService.canHandleResource(this.originalInput.preferredResource) &&
this.fileService.canHandleResource(this.modifiedInput.preferredResource)
) {
return {
original: this.originalInput.preferredResource,
modified: this.modifiedInput.preferredResource
};
}
return undefined;
}
async resolve(): Promise<EditorModel> {
// Create Model - we never reuse our cached model if refresh is true because we cannot

View File

@@ -55,6 +55,7 @@ export class ResourceEditorInput extends AbstractTextResourceEditorInput impleme
setName(name: string): void {
if (this.name !== name) {
this.name = name;
this._onDidChangeLabel.fire();
}
}

View File

@@ -56,7 +56,7 @@ export abstract class AbstractTextResourceEditorInput extends EditorInput implem
private updateLabel(): void {
// Clear any cached labels from before
this._basename = undefined;
this._name = undefined;
this._shortDescription = undefined;
this._mediumDescription = undefined;
this._longDescription = undefined;
@@ -76,17 +76,13 @@ export abstract class AbstractTextResourceEditorInput extends EditorInput implem
}
}
private _name: string | undefined = undefined;
getName(): string {
return this.basename;
}
private _basename: string | undefined;
private get basename(): string {
if (!this._basename) {
this._basename = this.labelService.getUriBasenameLabel(this._preferredResource);
if (typeof this._name !== 'string') {
this._name = this.labelService.getUriBasenameLabel(this._preferredResource);
}
return this._basename;
return this._name;
}
getDescription(verbosity: Verbosity = Verbosity.MEDIUM): string | undefined {
@@ -103,49 +99,55 @@ export abstract class AbstractTextResourceEditorInput extends EditorInput implem
private _shortDescription: string | undefined = undefined;
private get shortDescription(): string {
if (!this._shortDescription) {
if (typeof this._shortDescription !== 'string') {
this._shortDescription = this.labelService.getUriBasenameLabel(dirname(this._preferredResource));
}
return this._shortDescription;
}
private _mediumDescription: string | undefined = undefined;
private get mediumDescription(): string {
if (!this._mediumDescription) {
if (typeof this._mediumDescription !== 'string') {
this._mediumDescription = this.labelService.getUriLabel(dirname(this._preferredResource), { relative: true });
}
return this._mediumDescription;
}
private _longDescription: string | undefined = undefined;
private get longDescription(): string {
if (!this._longDescription) {
if (typeof this._longDescription !== 'string') {
this._longDescription = this.labelService.getUriLabel(dirname(this._preferredResource));
}
return this._longDescription;
}
private _shortTitle: string | undefined = undefined;
private get shortTitle(): string {
if (!this._shortTitle) {
if (typeof this._shortTitle !== 'string') {
this._shortTitle = this.getName();
}
return this._shortTitle;
}
private _mediumTitle: string | undefined = undefined;
private get mediumTitle(): string {
if (!this._mediumTitle) {
if (typeof this._mediumTitle !== 'string') {
this._mediumTitle = this.labelService.getUriLabel(this._preferredResource, { relative: true });
}
return this._mediumTitle;
}
private _longTitle: string | undefined = undefined;
private get longTitle(): string {
if (!this._longTitle) {
if (typeof this._longTitle !== 'string') {
this._longTitle = this.labelService.getUriLabel(this._preferredResource);
}
return this._longTitle;
}

View File

@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { isEmptyObject } from 'vs/base/common/types';
import { onUnexpectedError } from 'vs/base/common/errors';
@@ -22,13 +22,13 @@ export class Memento {
this.id = Memento.COMMON_PREFIX + id;
}
getMemento(scope: StorageScope): MementoObject {
getMemento(scope: StorageScope, target: StorageTarget): MementoObject {
// Scope by Workspace
if (scope === StorageScope.WORKSPACE) {
let workspaceMemento = Memento.workspaceMementos.get(this.id);
if (!workspaceMemento) {
workspaceMemento = new ScopedMemento(this.id, scope, this.storageService);
workspaceMemento = new ScopedMemento(this.id, scope, target, this.storageService);
Memento.workspaceMementos.set(this.id, workspaceMemento);
}
@@ -38,7 +38,7 @@ export class Memento {
// Scope Global
let globalMemento = Memento.globalMementos.get(this.id);
if (!globalMemento) {
globalMemento = new ScopedMemento(this.id, scope, this.storageService);
globalMemento = new ScopedMemento(this.id, scope, target, this.storageService);
Memento.globalMementos.set(this.id, globalMemento);
}
@@ -65,7 +65,7 @@ class ScopedMemento {
private readonly mementoObj: MementoObject;
constructor(private id: string, private scope: StorageScope, private storageService: IStorageService) {
constructor(private id: string, private scope: StorageScope, private target: StorageTarget, private storageService: IStorageService) {
this.mementoObj = this.load();
}
@@ -92,7 +92,7 @@ class ScopedMemento {
save(): void {
if (!isEmptyObject(this.mementoObj)) {
this.storageService.store(this.id, JSON.stringify(this.mementoObj), this.scope);
this.storageService.store(this.id, JSON.stringify(this.mementoObj), this.scope, this.target);
} else {
this.storageService.remove(this.id, this.scope);
}

View File

@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { INotification, INotificationHandle, INotificationActions, INotificationProgress, NoOpNotification, Severity, NotificationMessage, IPromptChoice, IStatusMessageOptions, NotificationsFilter, INotificationProgressProperties } from 'vs/platform/notification/common/notification';
import { INotification, INotificationHandle, INotificationActions, INotificationProgress, NoOpNotification, Severity, NotificationMessage, IPromptChoice, IStatusMessageOptions, NotificationsFilter, INotificationProgressProperties, IPromptChoiceWithMenu } from 'vs/platform/notification/common/notification';
import { toErrorMessage } from 'vs/base/common/errorMessage';
import { Event, Emitter } from 'vs/base/common/event';
import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
@@ -695,6 +695,7 @@ export class ChoiceAction extends Action {
readonly onDidRun = this._onDidRun.event;
private readonly _keepOpen: boolean;
private readonly _menu: ChoiceAction[] | undefined;
constructor(id: string, choice: IPromptChoice) {
super(id, choice.label, undefined, true, async () => {
@@ -707,6 +708,11 @@ export class ChoiceAction extends Action {
});
this._keepOpen = !!choice.keepOpen;
this._menu = !choice.isSecondary && (<IPromptChoiceWithMenu>choice).menu ? (<IPromptChoiceWithMenu>choice).menu.map((c, index) => new ChoiceAction(`${id}.${index}`, c)) : undefined;
}
get menu(): ChoiceAction[] | undefined {
return this._menu;
}
get keepOpen(): boolean {

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { registerColor, editorBackground, contrastBorder, transparent, editorWidgetBackground, textLinkForeground, lighten, darken, focusBorder, activeContrastBorder, editorWidgetForeground, editorErrorForeground, editorWarningForeground, editorInfoForeground, treeIndentGuidesStroke } from 'vs/platform/theme/common/colorRegistry';
import { registerColor, editorBackground, contrastBorder, transparent, editorWidgetBackground, textLinkForeground, lighten, darken, focusBorder, activeContrastBorder, editorWidgetForeground, editorErrorForeground, editorWarningForeground, editorInfoForeground, treeIndentGuidesStroke, errorForeground } from 'vs/platform/theme/common/colorRegistry';
import { IColorTheme } from 'vs/platform/theme/common/themeService';
import { Color } from 'vs/base/common/color';
@@ -401,6 +401,18 @@ export const STATUS_BAR_PROMINENT_ITEM_HOVER_BACKGROUND = registerColor('statusB
hc: Color.black.transparent(0.3),
}, nls.localize('statusBarProminentItemHoverBackground', "Status bar prominent items background color when hovering. Prominent items stand out from other status bar entries to indicate importance. Change mode `Toggle Tab Key Moves Focus` from command palette to see an example. The status bar is shown in the bottom of the window."));
export const STATUS_BAR_ERROR_ITEM_BACKGROUND = registerColor('statusBarItem.errorBackground', {
dark: darken(errorForeground, .4),
light: darken(errorForeground, .4),
hc: null,
}, nls.localize('statusBarErrorItemBackground', "Status bar error items background color. Error items stand out from other status bar entries to indicate error conditions. The status bar is shown in the bottom of the window."));
export const STATUS_BAR_ERROR_ITEM_FOREGROUND = registerColor('statusBarItem.errorForeground', {
dark: Color.white,
light: Color.white,
hc: Color.white,
}, nls.localize('statusBarErrorItemForeground', "Status bar error items foreground color. Error items stand out from other status bar entries to indicate error conditions. The status bar is shown in the bottom of the window."));
// < --- Activity Bar --- >
export const ACTIVITY_BAR_BACKGROUND = registerColor('activityBar.background', {

View File

@@ -25,8 +25,13 @@ import { IPaneComposite } from 'vs/workbench/common/panecomposite';
import { IAccessibilityInformation } from 'vs/platform/accessibility/common/accessibility';
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.'));
export const defaultViewIcon = registerIcon('default-view-icon', Codicon.window, localize('defaultViewIcon', 'Default view icon.'));
export namespace Extensions {
export const ViewContainersRegistry = 'workbench.registry.view.containers';
@@ -48,7 +53,7 @@ export interface IViewContainerDescriptor {
readonly storageId?: string;
readonly icon?: string | URI;
readonly icon?: ThemeIcon | URI;
readonly alwaysUseContainerInfo?: boolean;
@@ -216,7 +221,7 @@ export interface IViewDescriptor {
readonly canMoveView?: boolean;
readonly containerIcon?: string | URI;
readonly containerIcon?: ThemeIcon | URI;
readonly containerTitle?: string;
@@ -252,7 +257,7 @@ export interface IAddedViewDescriptorState {
export interface IViewContainerModel {
readonly title: string;
readonly icon: string | URI | undefined;
readonly icon: ThemeIcon | URI | undefined;
readonly onDidChangeContainerInfo: Event<{ title?: boolean, icon?: boolean }>;
readonly allViewDescriptors: ReadonlyArray<IViewDescriptor>;
@@ -290,11 +295,7 @@ export interface IViewContentDescriptor {
readonly when?: ContextKeyExpression | 'default';
readonly group?: string;
readonly order?: number;
/**
* ordered preconditions for each button in the content
*/
readonly preconditions?: (ContextKeyExpression | undefined)[];
readonly precondition?: ContextKeyExpression | undefined;
}
export interface IViewsRegistry {
@@ -703,6 +704,27 @@ export class ResolvableTreeItem implements ITreeItem {
get hasResolve(): boolean {
return this._hasResolve;
}
public resetResolve() {
this.resolved = false;
}
public asTreeItem(): ITreeItem {
return {
handle: this.handle,
parentHandle: this.parentHandle,
collapsibleState: this.collapsibleState,
label: this.label,
description: this.description,
icon: this.icon,
iconDark: this.iconDark,
themeIcon: this.themeIcon,
resourceUri: this.resourceUri,
tooltip: this.tooltip,
contextValue: this.contextValue,
command: this.command,
children: this.children,
accessibilityInformation: this.accessibilityInformation
};
}
}
export interface ITreeViewDataProvider {