mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode 0a7364f00514c46c9caceece15e1f82f82e3712f
This commit is contained in:
@@ -167,7 +167,7 @@ export interface IFileEditorInputFactory {
|
||||
/**
|
||||
* Creates new new editor input capable of showing files.
|
||||
*/
|
||||
createFileEditorInput(resource: URI, label: URI | undefined, encoding: string | undefined, mode: string | undefined, instantiationService: IInstantiationService): IFileEditorInput;
|
||||
createFileEditorInput(resource: URI, preferredResource: URI | undefined, encoding: string | undefined, mode: string | undefined, instantiationService: IInstantiationService): IFileEditorInput;
|
||||
|
||||
/**
|
||||
* Check if the provided object is a file editor input.
|
||||
@@ -649,20 +649,25 @@ export interface IModeSupport {
|
||||
export interface IFileEditorInput extends IEditorInput, IEncodingSupport, IModeSupport {
|
||||
|
||||
/**
|
||||
* Gets the resource this file input is about.
|
||||
* Gets the resource this file input is about. This will always be the
|
||||
* canonical form of the resource, so it may differ from the original
|
||||
* resource that was provided to create the input. Use `preferredResource`
|
||||
* for the form as it was created.
|
||||
*/
|
||||
readonly resource: URI;
|
||||
|
||||
/**
|
||||
* Gets the label of the editor. In most cases this will
|
||||
* be identical to the resource.
|
||||
* Gets the preferred resource of the editor. In most cases this will
|
||||
* be identical to the resource. But in some cases the preferredResource
|
||||
* may differ in path casing to the actual resource because we keep
|
||||
* canonical forms of resources in-memory.
|
||||
*/
|
||||
readonly label: URI;
|
||||
readonly preferredResource: URI;
|
||||
|
||||
/**
|
||||
* Sets the preferred label to use for this file input.
|
||||
* Sets the preferred resource to use for this file input.
|
||||
*/
|
||||
setLabel(label: URI): void;
|
||||
setPreferredResource(preferredResource: URI): void;
|
||||
|
||||
/**
|
||||
* Sets the preferred encoding to use for this file input.
|
||||
|
||||
@@ -22,12 +22,12 @@ export abstract class AbstractTextResourceEditorInput extends EditorInput {
|
||||
|
||||
private static readonly MEMOIZER = createMemoizer();
|
||||
|
||||
private _label: URI;
|
||||
get label(): URI { return this._label; }
|
||||
private _preferredResource: URI;
|
||||
get preferredResource(): URI { return this._preferredResource; }
|
||||
|
||||
constructor(
|
||||
public readonly resource: URI,
|
||||
preferredLabel: URI | undefined,
|
||||
preferredResource: URI | undefined,
|
||||
@IEditorService protected readonly editorService: IEditorService,
|
||||
@IEditorGroupsService protected readonly editorGroupService: IEditorGroupsService,
|
||||
@ITextFileService protected readonly textFileService: ITextFileService,
|
||||
@@ -37,7 +37,7 @@ export abstract class AbstractTextResourceEditorInput extends EditorInput {
|
||||
) {
|
||||
super();
|
||||
|
||||
this._label = preferredLabel || resource;
|
||||
this._preferredResource = preferredResource || resource;
|
||||
|
||||
this.registerListeners();
|
||||
}
|
||||
@@ -51,7 +51,7 @@ export abstract class AbstractTextResourceEditorInput extends EditorInput {
|
||||
}
|
||||
|
||||
private onLabelEvent(scheme: string): void {
|
||||
if (scheme === this._label.scheme) {
|
||||
if (scheme === this._preferredResource.scheme) {
|
||||
this.updateLabel();
|
||||
}
|
||||
}
|
||||
@@ -65,25 +65,21 @@ export abstract class AbstractTextResourceEditorInput extends EditorInput {
|
||||
this._onDidChangeLabel.fire();
|
||||
}
|
||||
|
||||
setLabel(label: URI): void {
|
||||
if (!extUri.isEqual(label, this._label)) {
|
||||
this._label = label;
|
||||
setPreferredResource(preferredResource: URI): void {
|
||||
if (!extUri.isEqual(preferredResource, this._preferredResource)) {
|
||||
this._preferredResource = preferredResource;
|
||||
|
||||
this.updateLabel();
|
||||
}
|
||||
}
|
||||
|
||||
getLabel(): URI {
|
||||
return this._label;
|
||||
}
|
||||
|
||||
getName(): string {
|
||||
return this.basename;
|
||||
}
|
||||
|
||||
@AbstractTextResourceEditorInput.MEMOIZER
|
||||
private get basename(): string {
|
||||
return this.labelService.getUriBasenameLabel(this._label);
|
||||
return this.labelService.getUriBasenameLabel(this._preferredResource);
|
||||
}
|
||||
|
||||
getDescription(verbosity: Verbosity = Verbosity.MEDIUM): string | undefined {
|
||||
@@ -100,17 +96,17 @@ export abstract class AbstractTextResourceEditorInput extends EditorInput {
|
||||
|
||||
@AbstractTextResourceEditorInput.MEMOIZER
|
||||
private get shortDescription(): string {
|
||||
return this.labelService.getUriBasenameLabel(dirname(this._label));
|
||||
return this.labelService.getUriBasenameLabel(dirname(this._preferredResource));
|
||||
}
|
||||
|
||||
@AbstractTextResourceEditorInput.MEMOIZER
|
||||
private get mediumDescription(): string {
|
||||
return this.labelService.getUriLabel(dirname(this._label), { relative: true });
|
||||
return this.labelService.getUriLabel(dirname(this._preferredResource), { relative: true });
|
||||
}
|
||||
|
||||
@AbstractTextResourceEditorInput.MEMOIZER
|
||||
private get longDescription(): string {
|
||||
return this.labelService.getUriLabel(dirname(this._label));
|
||||
return this.labelService.getUriLabel(dirname(this._preferredResource));
|
||||
}
|
||||
|
||||
@AbstractTextResourceEditorInput.MEMOIZER
|
||||
@@ -120,12 +116,12 @@ export abstract class AbstractTextResourceEditorInput extends EditorInput {
|
||||
|
||||
@AbstractTextResourceEditorInput.MEMOIZER
|
||||
private get mediumTitle(): string {
|
||||
return this.labelService.getUriLabel(this._label, { relative: true });
|
||||
return this.labelService.getUriLabel(this._preferredResource, { relative: true });
|
||||
}
|
||||
|
||||
@AbstractTextResourceEditorInput.MEMOIZER
|
||||
private get longTitle(): string {
|
||||
return this.labelService.getUriLabel(this._label);
|
||||
return this.labelService.getUriLabel(this._preferredResource);
|
||||
}
|
||||
|
||||
getTitle(verbosity: Verbosity): string {
|
||||
|
||||
@@ -618,6 +618,8 @@ export interface ITreeItemLabel {
|
||||
|
||||
highlights?: [number, number][];
|
||||
|
||||
strikethrough?: boolean;
|
||||
|
||||
}
|
||||
|
||||
export interface ITreeItem {
|
||||
|
||||
Reference in New Issue
Block a user