make event optional, event naming, relax badge length a little, https://github.com/microsoft/vscode/issues/54938

This commit is contained in:
Johannes Rieken
2020-11-18 10:04:14 +01:00
parent f9c3f0dda2
commit 12b808cf08
4 changed files with 9 additions and 9 deletions

View File

@@ -42,7 +42,7 @@ export class ExtHostDecorations implements ExtHostDecorationsShape {
this._provider.set(handle, { provider, extensionId });
this._proxy.$registerDecorationProvider(handle, extensionId.value);
const listener = provider.onDidChange(e => {
const listener = provider.onDidChangeFileDecorations && provider.onDidChangeFileDecorations(e => {
if (!e) {
this._proxy.$onDidChange(handle, null);
return;
@@ -75,7 +75,7 @@ export class ExtHostDecorations implements ExtHostDecorationsShape {
});
return new Disposable(() => {
listener.dispose();
listener?.dispose();
this._proxy.$unregisterDecorationProvider(handle);
this._provider.delete(handle);
});

View File

@@ -2720,8 +2720,8 @@ export enum ExtensionKind {
export class FileDecoration {
static validate(d: FileDecoration): void {
if (d.badge && d.badge.length !== 1) {
throw new Error(`The 'badge'-property must be undefined or a single character`);
if (d.badge && (d.badge.length === 1 || d.badge.length === 2)) {
throw new Error(`The 'badge'-property must be undefined or a short character`);
}
if (!d.color && !d.badge && !d.tooltip) {
throw new Error(`The decoration is empty`);