mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-26 23:00:29 -04:00
Merge from vscode 79a1f5a5ca0c6c53db617aa1fa5a2396d2caebe2
This commit is contained in:
@@ -14,3 +14,4 @@ export interface IActivity {
|
||||
}
|
||||
|
||||
export const GLOBAL_ACTIVITY_ID = 'workbench.action.globalActivity';
|
||||
export const ACCOUNTS_ACTIIVTY_ID = 'workbench.action.accountsActivity';
|
||||
|
||||
@@ -14,20 +14,14 @@ import { IInstantiationService, IConstructorSignature0, ServicesAccessor, Brande
|
||||
import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { IEditorGroup } 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, FileSystemProviderCapabilities } from 'vs/platform/files/common/files';
|
||||
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 { ITextFileSaveOptions, ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { IEditorService, IResourceEditorInputType } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { isEqual, dirname } from 'vs/base/common/resources';
|
||||
import { IResourceEditorInputType } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IRange } from 'vs/editor/common/core/range';
|
||||
import { createMemoizer } from 'vs/base/common/decorators';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { IFilesConfigurationService, AutoSaveMode } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
|
||||
|
||||
export const DirtyWorkingCopiesContext = new RawContextKey<boolean>('dirtyWorkingCopies', false);
|
||||
export const ActiveEditorContext = new RawContextKey<string | null>('activeEditor', null);
|
||||
@@ -403,6 +397,11 @@ export interface IEditorInput extends IDisposable {
|
||||
*/
|
||||
getTitle(verbosity?: Verbosity): string | undefined;
|
||||
|
||||
/**
|
||||
* Returns the aria label to be read out by a screen reader.
|
||||
*/
|
||||
getAriaLabel(): string;
|
||||
|
||||
/**
|
||||
* Resolves the input.
|
||||
*/
|
||||
@@ -512,6 +511,10 @@ export abstract class EditorInput extends Disposable implements IEditorInput {
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
getAriaLabel(): string {
|
||||
return this.getTitle(Verbosity.SHORT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the preferred editor for this input. A list of candidate editors is passed in that whee registered
|
||||
* for the input. This allows subclasses to decide late which editor to use for the input on a case by case basis.
|
||||
@@ -595,164 +598,6 @@ export abstract class EditorInput extends Disposable implements IEditorInput {
|
||||
}
|
||||
}
|
||||
|
||||
export abstract class TextResourceEditorInput extends EditorInput {
|
||||
|
||||
private static readonly MEMOIZER = createMemoizer();
|
||||
|
||||
constructor(
|
||||
public readonly resource: URI,
|
||||
@IEditorService protected readonly editorService: IEditorService,
|
||||
@IEditorGroupsService protected readonly editorGroupService: IEditorGroupsService,
|
||||
@ITextFileService protected readonly textFileService: ITextFileService,
|
||||
@ILabelService protected readonly labelService: ILabelService,
|
||||
@IFileService protected readonly fileService: IFileService,
|
||||
@IFilesConfigurationService protected readonly filesConfigurationService: IFilesConfigurationService
|
||||
) {
|
||||
super();
|
||||
|
||||
this.registerListeners();
|
||||
}
|
||||
|
||||
protected registerListeners(): void {
|
||||
|
||||
// Clear label memoizer on certain events that have impact
|
||||
this._register(this.labelService.onDidChangeFormatters(e => this.onLabelEvent(e.scheme)));
|
||||
this._register(this.fileService.onDidChangeFileSystemProviderRegistrations(e => this.onLabelEvent(e.scheme)));
|
||||
this._register(this.fileService.onDidChangeFileSystemProviderCapabilities(e => this.onLabelEvent(e.scheme)));
|
||||
}
|
||||
|
||||
private onLabelEvent(scheme: string): void {
|
||||
if (scheme === this.resource.scheme) {
|
||||
|
||||
// Clear any cached labels from before
|
||||
TextResourceEditorInput.MEMOIZER.clear();
|
||||
|
||||
// Trigger recompute of label
|
||||
this._onDidChangeLabel.fire();
|
||||
}
|
||||
}
|
||||
|
||||
getName(): string {
|
||||
return this.basename;
|
||||
}
|
||||
|
||||
@TextResourceEditorInput.MEMOIZER
|
||||
private get basename(): string {
|
||||
return this.labelService.getUriBasenameLabel(this.resource);
|
||||
}
|
||||
|
||||
getDescription(verbosity: Verbosity = Verbosity.MEDIUM): string | undefined {
|
||||
switch (verbosity) {
|
||||
case Verbosity.SHORT:
|
||||
return this.shortDescription;
|
||||
case Verbosity.LONG:
|
||||
return this.longDescription;
|
||||
case Verbosity.MEDIUM:
|
||||
default:
|
||||
return this.mediumDescription;
|
||||
}
|
||||
}
|
||||
|
||||
@TextResourceEditorInput.MEMOIZER
|
||||
private get shortDescription(): string {
|
||||
return this.labelService.getUriBasenameLabel(dirname(this.resource));
|
||||
}
|
||||
|
||||
@TextResourceEditorInput.MEMOIZER
|
||||
private get mediumDescription(): string {
|
||||
return this.labelService.getUriLabel(dirname(this.resource), { relative: true });
|
||||
}
|
||||
|
||||
@TextResourceEditorInput.MEMOIZER
|
||||
private get longDescription(): string {
|
||||
return this.labelService.getUriLabel(dirname(this.resource));
|
||||
}
|
||||
|
||||
@TextResourceEditorInput.MEMOIZER
|
||||
private get shortTitle(): string {
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
@TextResourceEditorInput.MEMOIZER
|
||||
private get mediumTitle(): string {
|
||||
return this.labelService.getUriLabel(this.resource, { relative: true });
|
||||
}
|
||||
|
||||
@TextResourceEditorInput.MEMOIZER
|
||||
private get longTitle(): string {
|
||||
return this.labelService.getUriLabel(this.resource);
|
||||
}
|
||||
|
||||
getTitle(verbosity: Verbosity): string {
|
||||
switch (verbosity) {
|
||||
case Verbosity.SHORT:
|
||||
return this.shortTitle;
|
||||
case Verbosity.LONG:
|
||||
return this.longTitle;
|
||||
default:
|
||||
case Verbosity.MEDIUM:
|
||||
return this.mediumTitle;
|
||||
}
|
||||
}
|
||||
|
||||
isUntitled(): boolean {
|
||||
return this.resource.scheme === Schemas.untitled;
|
||||
}
|
||||
|
||||
isReadonly(): boolean {
|
||||
if (this.isUntitled()) {
|
||||
return false; // untitled is never readonly
|
||||
}
|
||||
|
||||
return this.fileService.hasCapability(this.resource, FileSystemProviderCapabilities.Readonly);
|
||||
}
|
||||
|
||||
isSaving(): boolean {
|
||||
if (this.isUntitled()) {
|
||||
return false; // untitled is never saving automatically
|
||||
}
|
||||
|
||||
if (this.filesConfigurationService.getAutoSaveMode() === AutoSaveMode.AFTER_SHORT_DELAY) {
|
||||
return true; // a short auto save is configured, treat this as being saved
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
async save(group: GroupIdentifier, options?: ITextFileSaveOptions): Promise<IEditorInput | undefined> {
|
||||
return this.doSave(group, options, false);
|
||||
}
|
||||
|
||||
saveAs(group: GroupIdentifier, options?: ITextFileSaveOptions): Promise<IEditorInput | undefined> {
|
||||
return this.doSave(group, options, true);
|
||||
}
|
||||
|
||||
private async doSave(group: GroupIdentifier, options: ISaveOptions | undefined, saveAs: boolean): Promise<IEditorInput | undefined> {
|
||||
|
||||
// Save / Save As
|
||||
let target: URI | undefined;
|
||||
if (saveAs) {
|
||||
target = await this.textFileService.saveAs(this.resource, undefined, options);
|
||||
} else {
|
||||
target = await this.textFileService.save(this.resource, options);
|
||||
}
|
||||
|
||||
if (!target) {
|
||||
return undefined; // save cancelled
|
||||
}
|
||||
|
||||
if (!isEqual(target, this.resource)) {
|
||||
return this.editorService.createEditorInput({ resource: target });
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
async revert(group: GroupIdentifier, options?: IRevertOptions): Promise<void> {
|
||||
await this.textFileService.revert(this.resource, options);
|
||||
}
|
||||
}
|
||||
|
||||
export const enum EncodingMode {
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,7 +13,10 @@ 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 _modifiedModel: IEditorModel | null;
|
||||
get modifiedModel(): IEditorModel | null { return this._modifiedModel; }
|
||||
|
||||
constructor(originalModel: IEditorModel | null, modifiedModel: IEditorModel | null) {
|
||||
super();
|
||||
@@ -22,14 +25,6 @@ export class DiffEditorModel extends EditorModel {
|
||||
this._modifiedModel = modifiedModel;
|
||||
}
|
||||
|
||||
get originalModel(): IEditorModel | null {
|
||||
return this._originalModel;
|
||||
}
|
||||
|
||||
get modifiedModel(): IEditorModel | null {
|
||||
return this._modifiedModel;
|
||||
}
|
||||
|
||||
async load(): Promise<EditorModel> {
|
||||
await Promise.all([
|
||||
this._originalModel?.load(),
|
||||
|
||||
@@ -84,6 +84,9 @@ export class EditorGroup extends Disposable {
|
||||
private readonly _onDidChangeEditorPinned = this._register(new Emitter<EditorInput>());
|
||||
readonly onDidChangeEditorPinned = this._onDidChangeEditorPinned.event;
|
||||
|
||||
private readonly _onDidChangeEditorSticky = this._register(new Emitter<EditorInput>());
|
||||
readonly onDidChangeEditorSticky = this._onDidChangeEditorSticky.event;
|
||||
|
||||
//#endregion
|
||||
|
||||
private _id: GroupIdentifier;
|
||||
@@ -123,6 +126,12 @@ export class EditorGroup extends Disposable {
|
||||
private onConfigurationUpdated(): void {
|
||||
this.editorOpenPositioning = this.configurationService.getValue('workbench.editor.openPositioning');
|
||||
this.focusRecentEditorAfterClose = this.configurationService.getValue('workbench.editor.focusRecentEditorAfterClose');
|
||||
|
||||
if (this.configurationService.getValue('workbench.editor.showTabs') === false) {
|
||||
// Disabling tabs disables sticky editors until we support
|
||||
// an indication of sticky editors when tabs are disabled
|
||||
this.sticky = -1;
|
||||
}
|
||||
}
|
||||
|
||||
get count(): number {
|
||||
@@ -555,6 +564,9 @@ export class EditorGroup extends Disposable {
|
||||
|
||||
// Adjust sticky index
|
||||
this.sticky++;
|
||||
|
||||
// Event
|
||||
this._onDidChangeEditorSticky.fire(editor);
|
||||
}
|
||||
|
||||
unstick(candidate: EditorInput): EditorInput | undefined {
|
||||
@@ -580,6 +592,9 @@ export class EditorGroup extends Disposable {
|
||||
|
||||
// Adjust sticky index
|
||||
this.sticky--;
|
||||
|
||||
// Event
|
||||
this._onDidChangeEditorSticky.fire(editor);
|
||||
}
|
||||
|
||||
isSticky(candidateOrIndex: EditorInput | number): boolean {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ITextEditorModel, IModeSupport, TextResourceEditorInput } from 'vs/workbench/common/editor';
|
||||
import { ITextEditorModel, IModeSupport } from 'vs/workbench/common/editor';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IReference } from 'vs/base/common/lifecycle';
|
||||
import { ITextModelService } from 'vs/editor/common/services/resolverService';
|
||||
@@ -14,12 +14,13 @@ import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editor
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { IFilesConfigurationService } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
|
||||
import { AbstractTextResourceEditorInput } from 'vs/workbench/common/editor/textResourceEditorInput';
|
||||
|
||||
/**
|
||||
* A read-only text editor input whos contents are made of the provided resource that points to an existing
|
||||
* code editor model.
|
||||
*/
|
||||
export class ResourceEditorInput extends TextResourceEditorInput implements IModeSupport {
|
||||
export class ResourceEditorInput extends AbstractTextResourceEditorInput implements IModeSupport {
|
||||
|
||||
static readonly ID: string = 'workbench.editors.resourceEditorInput';
|
||||
|
||||
@@ -64,6 +65,7 @@ export class ResourceEditorInput extends TextResourceEditorInput implements IMod
|
||||
setDescription(description: string): void {
|
||||
if (this.description !== description) {
|
||||
this.description = description;
|
||||
|
||||
this._onDidChangeLabel.fire();
|
||||
}
|
||||
}
|
||||
@@ -87,9 +89,8 @@ export class ResourceEditorInput extends TextResourceEditorInput implements IMod
|
||||
|
||||
const ref = await this.modelReference;
|
||||
|
||||
const model = ref.object;
|
||||
|
||||
// Ensure the resolved model is of expected type
|
||||
const model = ref.object;
|
||||
if (!(model instanceof ResourceEditorModel)) {
|
||||
ref.dispose();
|
||||
this.modelReference = undefined;
|
||||
|
||||
@@ -15,9 +15,13 @@ 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 _modifiedModel: BaseTextEditorModel | null;
|
||||
get modifiedModel(): BaseTextEditorModel | null { return this._modifiedModel; }
|
||||
|
||||
private _textDiffEditorModel: IDiffEditorModel | null = null;
|
||||
get textDiffEditorModel(): IDiffEditorModel | null { return this._textDiffEditorModel; }
|
||||
|
||||
constructor(originalModel: BaseTextEditorModel, modifiedModel: BaseTextEditorModel) {
|
||||
super(originalModel, modifiedModel);
|
||||
@@ -28,14 +32,6 @@ export class TextDiffEditorModel extends DiffEditorModel {
|
||||
this.updateTextDiffEditorModel();
|
||||
}
|
||||
|
||||
get originalModel(): BaseTextEditorModel | null {
|
||||
return this._originalModel;
|
||||
}
|
||||
|
||||
get modifiedModel(): BaseTextEditorModel | null {
|
||||
return this._modifiedModel;
|
||||
}
|
||||
|
||||
async load(): Promise<EditorModel> {
|
||||
await super.load();
|
||||
|
||||
@@ -63,10 +59,6 @@ export class TextDiffEditorModel extends DiffEditorModel {
|
||||
}
|
||||
}
|
||||
|
||||
get textDiffEditorModel(): IDiffEditorModel | null {
|
||||
return this._textDiffEditorModel;
|
||||
}
|
||||
|
||||
isResolved(): boolean {
|
||||
return !!this._textDiffEditorModel;
|
||||
}
|
||||
|
||||
177
src/vs/workbench/common/editor/textResourceEditorInput.ts
Normal file
177
src/vs/workbench/common/editor/textResourceEditorInput.ts
Normal file
@@ -0,0 +1,177 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { EditorInput, Verbosity, GroupIdentifier, IEditorInput, ISaveOptions, IRevertOptions } from 'vs/workbench/common/editor';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ITextFileService, ITextFileSaveOptions } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { IFileService, FileSystemProviderCapabilities } from 'vs/platform/files/common/files';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { IFilesConfigurationService, AutoSaveMode } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
|
||||
import { createMemoizer } from 'vs/base/common/decorators';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { dirname, isEqual } from 'vs/base/common/resources';
|
||||
|
||||
/**
|
||||
* The base class for all editor inputs that open in text editors.
|
||||
*/
|
||||
export abstract class AbstractTextResourceEditorInput extends EditorInput {
|
||||
|
||||
private static readonly MEMOIZER = createMemoizer();
|
||||
|
||||
constructor(
|
||||
public readonly resource: URI,
|
||||
@IEditorService protected readonly editorService: IEditorService,
|
||||
@IEditorGroupsService protected readonly editorGroupService: IEditorGroupsService,
|
||||
@ITextFileService protected readonly textFileService: ITextFileService,
|
||||
@ILabelService protected readonly labelService: ILabelService,
|
||||
@IFileService protected readonly fileService: IFileService,
|
||||
@IFilesConfigurationService protected readonly filesConfigurationService: IFilesConfigurationService
|
||||
) {
|
||||
super();
|
||||
|
||||
this.registerListeners();
|
||||
}
|
||||
|
||||
protected registerListeners(): void {
|
||||
|
||||
// Clear label memoizer on certain events that have impact
|
||||
this._register(this.labelService.onDidChangeFormatters(e => this.onLabelEvent(e.scheme)));
|
||||
this._register(this.fileService.onDidChangeFileSystemProviderRegistrations(e => this.onLabelEvent(e.scheme)));
|
||||
this._register(this.fileService.onDidChangeFileSystemProviderCapabilities(e => this.onLabelEvent(e.scheme)));
|
||||
}
|
||||
|
||||
private onLabelEvent(scheme: string): void {
|
||||
if (scheme === this.resource.scheme) {
|
||||
|
||||
// Clear any cached labels from before
|
||||
AbstractTextResourceEditorInput.MEMOIZER.clear();
|
||||
|
||||
// Trigger recompute of label
|
||||
this._onDidChangeLabel.fire();
|
||||
}
|
||||
}
|
||||
|
||||
getName(): string {
|
||||
return this.basename;
|
||||
}
|
||||
|
||||
@AbstractTextResourceEditorInput.MEMOIZER
|
||||
private get basename(): string {
|
||||
return this.labelService.getUriBasenameLabel(this.resource);
|
||||
}
|
||||
|
||||
getDescription(verbosity: Verbosity = Verbosity.MEDIUM): string | undefined {
|
||||
switch (verbosity) {
|
||||
case Verbosity.SHORT:
|
||||
return this.shortDescription;
|
||||
case Verbosity.LONG:
|
||||
return this.longDescription;
|
||||
case Verbosity.MEDIUM:
|
||||
default:
|
||||
return this.mediumDescription;
|
||||
}
|
||||
}
|
||||
|
||||
@AbstractTextResourceEditorInput.MEMOIZER
|
||||
private get shortDescription(): string {
|
||||
return this.labelService.getUriBasenameLabel(dirname(this.resource));
|
||||
}
|
||||
|
||||
@AbstractTextResourceEditorInput.MEMOIZER
|
||||
private get mediumDescription(): string {
|
||||
return this.labelService.getUriLabel(dirname(this.resource), { relative: true });
|
||||
}
|
||||
|
||||
@AbstractTextResourceEditorInput.MEMOIZER
|
||||
private get longDescription(): string {
|
||||
return this.labelService.getUriLabel(dirname(this.resource));
|
||||
}
|
||||
|
||||
@AbstractTextResourceEditorInput.MEMOIZER
|
||||
private get shortTitle(): string {
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
@AbstractTextResourceEditorInput.MEMOIZER
|
||||
private get mediumTitle(): string {
|
||||
return this.labelService.getUriLabel(this.resource, { relative: true });
|
||||
}
|
||||
|
||||
@AbstractTextResourceEditorInput.MEMOIZER
|
||||
private get longTitle(): string {
|
||||
return this.labelService.getUriLabel(this.resource);
|
||||
}
|
||||
|
||||
getTitle(verbosity: Verbosity): string {
|
||||
switch (verbosity) {
|
||||
case Verbosity.SHORT:
|
||||
return this.shortTitle;
|
||||
case Verbosity.LONG:
|
||||
return this.longTitle;
|
||||
default:
|
||||
case Verbosity.MEDIUM:
|
||||
return this.mediumTitle;
|
||||
}
|
||||
}
|
||||
|
||||
isUntitled(): boolean {
|
||||
return this.resource.scheme === Schemas.untitled;
|
||||
}
|
||||
|
||||
isReadonly(): boolean {
|
||||
if (this.isUntitled()) {
|
||||
return false; // untitled is never readonly
|
||||
}
|
||||
|
||||
return this.fileService.hasCapability(this.resource, FileSystemProviderCapabilities.Readonly);
|
||||
}
|
||||
|
||||
isSaving(): boolean {
|
||||
if (this.isUntitled()) {
|
||||
return false; // untitled is never saving automatically
|
||||
}
|
||||
|
||||
if (this.filesConfigurationService.getAutoSaveMode() === AutoSaveMode.AFTER_SHORT_DELAY) {
|
||||
return true; // a short auto save is configured, treat this as being saved
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
async save(group: GroupIdentifier, options?: ITextFileSaveOptions): Promise<IEditorInput | undefined> {
|
||||
return this.doSave(group, options, false);
|
||||
}
|
||||
|
||||
saveAs(group: GroupIdentifier, options?: ITextFileSaveOptions): Promise<IEditorInput | undefined> {
|
||||
return this.doSave(group, options, true);
|
||||
}
|
||||
|
||||
private async doSave(group: GroupIdentifier, options: ISaveOptions | undefined, saveAs: boolean): Promise<IEditorInput | undefined> {
|
||||
|
||||
// Save / Save As
|
||||
let target: URI | undefined;
|
||||
if (saveAs) {
|
||||
target = await this.textFileService.saveAs(this.resource, undefined, options);
|
||||
} else {
|
||||
target = await this.textFileService.save(this.resource, options);
|
||||
}
|
||||
|
||||
if (!target) {
|
||||
return undefined; // save cancelled
|
||||
}
|
||||
|
||||
if (!isEqual(target, this.resource)) {
|
||||
return this.editorService.createEditorInput({ resource: target });
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
async revert(group: GroupIdentifier, options?: IRevertOptions): Promise<void> {
|
||||
await this.textFileService.revert(this.resource, options);
|
||||
}
|
||||
}
|
||||
@@ -283,18 +283,50 @@ export const PANEL_ACTIVE_TITLE_BORDER = registerColor('panelTitle.activeBorder'
|
||||
hc: contrastBorder
|
||||
}, nls.localize('panelActiveTitleBorder', "Border color for the active panel title. Panels are shown below the editor area and contain views like output and integrated terminal."));
|
||||
|
||||
export const PANEL_DRAG_AND_DROP_BACKGROUND = registerColor('panel.dropBackground', {
|
||||
dark: Color.white.transparent(0.12),
|
||||
light: Color.fromHex('#2677CB').transparent(0.18),
|
||||
hc: Color.white.transparent(0.12)
|
||||
}, nls.localize('panelDragAndDropBackground', "Drag and drop feedback color for the panel title items. The color should have transparency so that the panel entries can still shine through. Panels are shown below the editor area and contain views like output and integrated terminal."));
|
||||
|
||||
export const PANEL_INPUT_BORDER = registerColor('panelInput.border', {
|
||||
dark: null,
|
||||
light: Color.fromHex('#ddd'),
|
||||
hc: null
|
||||
}, nls.localize('panelInputBorder', "Input box border for inputs in the panel."));
|
||||
|
||||
export const PANEL_DRAG_AND_DROP_BORDER = registerColor('panel.dropBorder', {
|
||||
dark: PANEL_ACTIVE_TITLE_FOREGROUND,
|
||||
light: PANEL_ACTIVE_TITLE_FOREGROUND,
|
||||
hc: PANEL_ACTIVE_TITLE_FOREGROUND,
|
||||
}, nls.localize('panelDragAndDropBorder', "Drag and drop feedback color for the panel titles. Panels are shown below the editor area and contain views like output and integrated terminal."));
|
||||
|
||||
|
||||
export const PANEL_SECTION_DRAG_AND_DROP_BACKGROUND = registerColor('panelSection.dropBackground', {
|
||||
dark: EDITOR_DRAG_AND_DROP_BACKGROUND,
|
||||
light: EDITOR_DRAG_AND_DROP_BACKGROUND,
|
||||
hc: EDITOR_DRAG_AND_DROP_BACKGROUND,
|
||||
}, nls.localize('panelSectionDragAndDropBackground', "Drag and drop feedback color for the panel sections. The color should have transparency so that the panel sections can still shine through. Panels are shown below the editor area and contain views like output and integrated terminal."));
|
||||
|
||||
export const PANEL_SECTION_HEADER_BACKGROUND = registerColor('panelSectionHeader.background', {
|
||||
dark: Color.fromHex('#808080').transparent(0.2),
|
||||
light: Color.fromHex('#808080').transparent(0.2),
|
||||
hc: null
|
||||
}, nls.localize('panelSectionHeaderBackground', "Panel section header background color. Panels are shown below the editor area and contain views like output and integrated terminal."));
|
||||
|
||||
export const PANEL_SECTION_HEADER_FOREGROUND = registerColor('panelSectionHeader.foreground', {
|
||||
dark: null,
|
||||
light: null,
|
||||
hc: null
|
||||
}, nls.localize('panelSectionHeaderForeground', "Panel section header foreground color. Panels are shown below the editor area and contain views like output and integrated terminal."));
|
||||
|
||||
export const PANEL_SECTION_HEADER_BORDER = registerColor('panelSectionHeader.border', {
|
||||
dark: contrastBorder,
|
||||
light: contrastBorder,
|
||||
hc: contrastBorder
|
||||
}, nls.localize('panelSectionHeaderBorder', "Panel section header border color. Panels are shown below the editor area and contain views like output and integrated terminal."));
|
||||
|
||||
export const PANEL_SECTION_BORDER = registerColor('panelSection.border', {
|
||||
dark: PANEL_BORDER,
|
||||
light: PANEL_BORDER,
|
||||
hc: PANEL_BORDER
|
||||
}, nls.localize('panelSectionBorder', "Panel section border color. Panels are shown below the editor area and contain views like output and integrated terminal."));
|
||||
|
||||
|
||||
// < --- Status --- >
|
||||
|
||||
export const STATUS_BAR_FOREGROUND = registerColor('statusBar.foreground', {
|
||||
@@ -407,11 +439,11 @@ export const ACTIVITY_BAR_ACTIVE_BACKGROUND = registerColor('activityBar.activeB
|
||||
hc: null
|
||||
}, nls.localize('activityBarActiveBackground', "Activity bar background color for the active item. The activity bar is showing on the far left or right and allows to switch between views of the side bar."));
|
||||
|
||||
export const ACTIVITY_BAR_DRAG_AND_DROP_BACKGROUND = registerColor('activityBar.dropBackground', {
|
||||
dark: Color.white.transparent(0.12),
|
||||
light: Color.white.transparent(0.12),
|
||||
hc: Color.white.transparent(0.12),
|
||||
}, nls.localize('activityBarDragAndDropBackground', "Drag and drop feedback color for the activity bar items. The color should have transparency so that the activity bar entries can still shine through. The activity bar is showing on the far left or right and allows to switch between views of the side bar."));
|
||||
export const ACTIVITY_BAR_DRAG_AND_DROP_BORDER = registerColor('activityBar.dropBorder', {
|
||||
dark: ACTIVITY_BAR_FOREGROUND,
|
||||
light: ACTIVITY_BAR_FOREGROUND,
|
||||
hc: ACTIVITY_BAR_FOREGROUND,
|
||||
}, nls.localize('activityBarDragAndDropBorder', "Drag and drop feedback color for the activity bar items. The activity bar is showing on the far left or right and allows to switch between views of the side bar."));
|
||||
|
||||
export const ACTIVITY_BAR_BADGE_BACKGROUND = registerColor('activityBarBadge.background', {
|
||||
dark: '#007ACC',
|
||||
@@ -480,9 +512,9 @@ export const SIDE_BAR_TITLE_FOREGROUND = registerColor('sideBarTitle.foreground'
|
||||
}, nls.localize('sideBarTitleForeground', "Side bar title foreground color. The side bar is the container for views like explorer and search."));
|
||||
|
||||
export const SIDE_BAR_DRAG_AND_DROP_BACKGROUND = registerColor('sideBar.dropBackground', {
|
||||
dark: Color.white.transparent(0.12),
|
||||
light: Color.black.transparent(0.1),
|
||||
hc: Color.white.transparent(0.3),
|
||||
dark: EDITOR_DRAG_AND_DROP_BACKGROUND,
|
||||
light: EDITOR_DRAG_AND_DROP_BACKGROUND,
|
||||
hc: EDITOR_DRAG_AND_DROP_BACKGROUND,
|
||||
}, nls.localize('sideBarDragAndDropBackground', "Drag and drop feedback color for the side bar sections. The color should have transparency so that the side bar sections can still shine through. The side bar is the container for views like explorer and search."));
|
||||
|
||||
export const SIDE_BAR_SECTION_HEADER_BACKGROUND = registerColor('sideBarSectionHeader.background', {
|
||||
@@ -510,31 +542,31 @@ export const TITLE_BAR_ACTIVE_FOREGROUND = registerColor('titleBar.activeForegro
|
||||
dark: '#CCCCCC',
|
||||
light: '#333333',
|
||||
hc: '#FFFFFF'
|
||||
}, nls.localize('titleBarActiveForeground', "Title bar foreground when the window is active. Note that this color is currently only supported on macOS."));
|
||||
}, nls.localize('titleBarActiveForeground', "Title bar foreground when the window is active."));
|
||||
|
||||
export const TITLE_BAR_INACTIVE_FOREGROUND = registerColor('titleBar.inactiveForeground', {
|
||||
dark: transparent(TITLE_BAR_ACTIVE_FOREGROUND, 0.6),
|
||||
light: transparent(TITLE_BAR_ACTIVE_FOREGROUND, 0.6),
|
||||
hc: null
|
||||
}, nls.localize('titleBarInactiveForeground', "Title bar foreground when the window is inactive. Note that this color is currently only supported on macOS."));
|
||||
}, nls.localize('titleBarInactiveForeground', "Title bar foreground when the window is inactive."));
|
||||
|
||||
export const TITLE_BAR_ACTIVE_BACKGROUND = registerColor('titleBar.activeBackground', {
|
||||
dark: '#3C3C3C',
|
||||
light: '#DDDDDD',
|
||||
hc: '#000000'
|
||||
}, nls.localize('titleBarActiveBackground', "Title bar background when the window is active. Note that this color is currently only supported on macOS."));
|
||||
}, nls.localize('titleBarActiveBackground', "Title bar background when the window is active."));
|
||||
|
||||
export const TITLE_BAR_INACTIVE_BACKGROUND = registerColor('titleBar.inactiveBackground', {
|
||||
dark: transparent(TITLE_BAR_ACTIVE_BACKGROUND, 0.6),
|
||||
light: transparent(TITLE_BAR_ACTIVE_BACKGROUND, 0.6),
|
||||
hc: null
|
||||
}, nls.localize('titleBarInactiveBackground', "Title bar background when the window is inactive. Note that this color is currently only supported on macOS."));
|
||||
}, nls.localize('titleBarInactiveBackground', "Title bar background when the window is inactive."));
|
||||
|
||||
export const TITLE_BAR_BORDER = registerColor('titleBar.border', {
|
||||
dark: null,
|
||||
light: null,
|
||||
hc: contrastBorder
|
||||
}, nls.localize('titleBarBorder', "Title bar border color. Note that this color is currently only supported on macOS."));
|
||||
}, nls.localize('titleBarBorder', "Title bar border color."));
|
||||
|
||||
// < --- Menubar --- >
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import { SetMap } from 'vs/base/common/collections';
|
||||
import { IProgressIndicator } from 'vs/platform/progress/common/progress';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { IPaneComposite } from 'vs/workbench/common/panecomposite';
|
||||
import { IAccessibilityInformation } from 'vs/platform/accessibility/common/accessibility';
|
||||
|
||||
export const TEST_VIEW_CONTAINER_ID = 'workbench.view.extension.test';
|
||||
|
||||
@@ -49,8 +50,6 @@ export interface IViewContainerDescriptor {
|
||||
|
||||
readonly alwaysUseContainerInfo?: boolean;
|
||||
|
||||
readonly order?: number;
|
||||
|
||||
readonly focusCommand?: { id: string, keybindings?: IKeybindings };
|
||||
|
||||
readonly viewOrderDelegate?: ViewOrderDelegate;
|
||||
@@ -60,6 +59,8 @@ export interface IViewContainerDescriptor {
|
||||
readonly extensionId?: ExtensionIdentifier;
|
||||
|
||||
readonly rejectAddedViews?: boolean;
|
||||
|
||||
order?: number;
|
||||
}
|
||||
|
||||
export interface IViewContainersRegistry {
|
||||
@@ -211,6 +212,8 @@ export interface IViewDescriptor {
|
||||
|
||||
readonly containerIcon?: string | URI;
|
||||
|
||||
readonly containerTitle?: string;
|
||||
|
||||
// Applies only to newly created views
|
||||
readonly hideByDefault?: boolean;
|
||||
|
||||
@@ -234,6 +237,11 @@ export interface IAddedViewDescriptorRef extends IViewDescriptorRef {
|
||||
size?: number;
|
||||
}
|
||||
|
||||
export interface IAddedViewDescriptorState {
|
||||
viewDescriptor: IViewDescriptor,
|
||||
collapsed?: boolean;
|
||||
}
|
||||
|
||||
export interface IViewContainerModel {
|
||||
|
||||
readonly title: string;
|
||||
@@ -507,7 +515,7 @@ export interface IViewDescriptorService {
|
||||
getViewContainerModel(viewContainer: ViewContainer): IViewContainerModel;
|
||||
|
||||
readonly onDidChangeContainerLocation: Event<{ viewContainer: ViewContainer, from: ViewContainerLocation, to: ViewContainerLocation }>;
|
||||
moveViewContainerToLocation(viewContainer: ViewContainer, location: ViewContainerLocation): void;
|
||||
moveViewContainerToLocation(viewContainer: ViewContainer, location: ViewContainerLocation, order?: number): void;
|
||||
|
||||
// Views
|
||||
getViewDescriptorById(id: string): IViewDescriptor | null;
|
||||
@@ -632,6 +640,8 @@ export interface ITreeItem {
|
||||
command?: Command;
|
||||
|
||||
children?: ITreeItem[];
|
||||
|
||||
accessibilityInformation?: IAccessibilityInformation;
|
||||
}
|
||||
|
||||
export interface ITreeViewDataProvider {
|
||||
|
||||
Reference in New Issue
Block a user