mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Merge VS Code 1.23.1 (#1520)
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
'use strict';
|
||||
|
||||
import uri from 'vs/base/common/uri';
|
||||
import resources = require('vs/base/common/resources');
|
||||
import * as resources from 'vs/base/common/resources';
|
||||
import { IconLabel, IIconLabelValueOptions, IIconLabelCreationOptions } from 'vs/base/browser/ui/iconLabel/iconLabel';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
@@ -25,6 +25,7 @@ import { Schemas } from 'vs/base/common/network';
|
||||
import { FileKind, FILES_ASSOCIATIONS_CONFIG } from 'vs/platform/files/common/files';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
|
||||
export interface IResourceLabel {
|
||||
name: string;
|
||||
@@ -38,11 +39,16 @@ export interface IResourceLabelOptions extends IIconLabelValueOptions {
|
||||
}
|
||||
|
||||
export class ResourceLabel extends IconLabel {
|
||||
|
||||
private toDispose: IDisposable[];
|
||||
private label: IResourceLabel;
|
||||
private options: IResourceLabelOptions;
|
||||
private computedIconClasses: string[];
|
||||
private lastKnownConfiguredLangId: string;
|
||||
private computedPathLabel: string;
|
||||
|
||||
private _onDidRender = new Emitter<void>();
|
||||
readonly onDidRender: Event<void> = this._onDidRender.event;
|
||||
|
||||
constructor(
|
||||
container: HTMLElement,
|
||||
@@ -121,6 +127,10 @@ export class ResourceLabel extends IconLabel {
|
||||
this.label = label;
|
||||
this.options = options;
|
||||
|
||||
if (hasResourceChanged) {
|
||||
this.computedPathLabel = void 0; // reset path label due to resource change
|
||||
}
|
||||
|
||||
this.render(hasResourceChanged);
|
||||
}
|
||||
|
||||
@@ -151,6 +161,7 @@ export class ResourceLabel extends IconLabel {
|
||||
this.options = void 0;
|
||||
this.lastKnownConfiguredLangId = void 0;
|
||||
this.computedIconClasses = void 0;
|
||||
this.computedPathLabel = void 0;
|
||||
|
||||
this.setValue();
|
||||
}
|
||||
@@ -184,7 +195,11 @@ export class ResourceLabel extends IconLabel {
|
||||
if (this.options && typeof this.options.title === 'string') {
|
||||
iconLabelOptions.title = this.options.title;
|
||||
} else if (resource && resource.scheme !== Schemas.data /* do not accidentally inline Data URIs */) {
|
||||
iconLabelOptions.title = getPathLabel(resource, void 0, this.environmentService);
|
||||
if (!this.computedPathLabel) {
|
||||
this.computedPathLabel = getPathLabel(resource, void 0, this.environmentService);
|
||||
}
|
||||
|
||||
iconLabelOptions.title = this.computedPathLabel;
|
||||
}
|
||||
|
||||
if (!this.computedIconClasses) {
|
||||
@@ -197,7 +212,7 @@ export class ResourceLabel extends IconLabel {
|
||||
}
|
||||
|
||||
if (this.options && this.options.fileDecorations && resource) {
|
||||
let deco = this.decorationsService.getDecoration(
|
||||
const deco = this.decorationsService.getDecoration(
|
||||
resource,
|
||||
this.options.fileKind !== FileKind.FILE,
|
||||
this.options.fileDecorations.data
|
||||
@@ -207,9 +222,11 @@ export class ResourceLabel extends IconLabel {
|
||||
if (deco.tooltip) {
|
||||
iconLabelOptions.title = `${iconLabelOptions.title} • ${deco.tooltip}`;
|
||||
}
|
||||
|
||||
if (this.options.fileDecorations.colors) {
|
||||
iconLabelOptions.extraClasses.push(deco.labelClassName);
|
||||
}
|
||||
|
||||
if (this.options.fileDecorations.badges) {
|
||||
iconLabelOptions.extraClasses.push(deco.badgeClassName);
|
||||
}
|
||||
@@ -217,6 +234,8 @@ export class ResourceLabel extends IconLabel {
|
||||
}
|
||||
|
||||
this.setValue(label, this.label.description, iconLabelOptions);
|
||||
|
||||
this._onDidRender.fire();
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
@@ -227,6 +246,7 @@ export class ResourceLabel extends IconLabel {
|
||||
this.options = void 0;
|
||||
this.lastKnownConfiguredLangId = void 0;
|
||||
this.computedIconClasses = void 0;
|
||||
this.computedPathLabel = void 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user