diff --git a/src/vs/workbench/services/decorations/browser/decorations.ts b/src/vs/workbench/services/decorations/browser/decorations.ts index 6d1e660737537f7147e4f2f4ca9b7ca37841a469..16ba75cd049ba63155d9d33c977f9be843f3055b 100644 --- a/src/vs/workbench/services/decorations/browser/decorations.ts +++ b/src/vs/workbench/services/decorations/browser/decorations.ts @@ -26,7 +26,7 @@ export interface IDecoration { readonly tooltip: string; readonly labelClassName: string; readonly badgeClassName: string; - update(source?: string, data?: IDecorationData): IDecoration; + update(data: IDecorationData): IDecoration; } export interface IDecorationsProvider { diff --git a/src/vs/workbench/services/decorations/browser/decorationsService.ts b/src/vs/workbench/services/decorations/browser/decorationsService.ts index 101a0f69d968caa616abcdf5253ffc55e3fadb45..d8b1f1cbe899493ad82d9b5ebde2be13367127e9 100644 --- a/src/vs/workbench/services/decorations/browser/decorationsService.ts +++ b/src/vs/workbench/services/decorations/browser/decorationsService.ts @@ -141,25 +141,12 @@ class DecorationStyles { labelClassName, badgeClassName, tooltip, - update: (source, insert) => { + update: (replace) => { let newData = data.slice(); - if (!source) { - // add -> just append - newData.push(insert); - - } else { - // remove/replace -> require a walk - for (let i = 0; i < newData.length; i++) { - if (newData[i].source === source) { - if (!insert) { - // remove - newData.splice(i, 1); - i--; - } else { - // replace - newData[i] = insert; - } - } + for (let i = 0; i < newData.length; i++) { + if (newData[i].source === replace.source) { + // replace + newData[i] = replace; } } return this.asDecoration(newData, onlyChildren); @@ -434,7 +421,7 @@ export class FileDecorationsService implements IDecorationsService { // result, maybe overwrite let result = this._decorationStyles.asDecoration(data, containsChildren); if (overwrite) { - return result.update(overwrite.source, overwrite); + return result.update(overwrite); } else { return result; }