Change:
Steps to Reproduce: a notebook with a markdown cell that has multiple headers e.g. the preview for the markdown cell - shift+enter symbols quickpick ctrl+shift+o and arrow down through the symbols list :bug: cell decoration appears for the first item but then is removed for the second

Discussion:
private _removeCellDecoration(decorationId: string) { const options = this._resolvedCellDecorations.get(decorationId); <ins> this._resolvedCellDecorations.delete(decorationId); </ins> if (options) { <ins> for (const existingOptions of this._resolvedCellDecorations.values()) { // don't remove decorations that are applied from other entries if (options.className === existingOptions.className) { options.className = undefined; } if (options.outputClassName === existingOptions.outputClassName) { options.outputClassName = undefined; } if (options.gutterClassName === existingOptions.gutterClassName) { options.gutterClassName = undefined; } if (options.topClassName === existingOptions.topClassName) { options.topClassName = undefined; } } </ins> this._cellDecorationsChanged.fire({ added: [], removed: [options] }); <del> this._resolvedCellDecorations.delete(decorationId); </del> } }

<ins> /*--------------------------------------------------------------------------------------------- *  Copyright (c) Microsoft Corporation. All rights reserved. *  Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; import { CellKind } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { withTestNotebook } from 'vs/workbench/contrib/notebook/test/browser/testNotebookEditor'; import { ensureNoDisposablesAreLeakedInTestSuite } from 'vs/base/test/common/utils'; import { Event } from 'vs/base/common/event'; suite('CellDecorations', () => { ensureNoDisposablesAreLeakedInTestSuite(); test('Add and remove a cell decoration', async function () { await withTestNotebook( [ ['# header a', 'markdown', CellKind.Markup, [], {}], ], async (editor, viewModel) => { const cell = viewModel.cellAt(0); assert.ok(cell); let added = false; Event.once(cell.onCellDecorationsChanged)(e => added = !!e.added.find(decoration => decoration.className === 'style1')); const decorationIds = cell.deltaCellDecorations([], [{ className: 'style1' }]); assert.ok(cell.getCellDecorations().find(dec => dec.className === 'style1')); let removed = false; Event.once(cell.onCellDecorationsChanged)(e => removed = !!e.removed.find(decoration => decoration.className === 'style1')); cell.deltaCellDecorations(decorationIds, []); assert.ok(!cell.getCellDecorations().find(dec => dec.className === 'style1')); assert.ok(added); assert.ok(removed); }); }); test('Removing one cell decoration should not remove all', async function () { await withTestNotebook( [ ['# header a', 'markdown', CellKind.Markup, [], {}], ], async (editor, viewModel) => { const cell = viewModel.cellAt(0); assert.ok(cell); const decorationIds = cell.deltaCellDecorations([], [{ className: 'style1', outputClassName: 'style1' }]); cell.deltaCellDecorations([], [{ className: 'style1' }]); let styleRemoved = false; let outputStyleRemoved = false; Event.once(cell.onCellDecorationsChanged)(e => { styleRemoved = !!e.removed.find(decoration => decoration.className === 'style1'); outputStyleRemoved = !!e.removed.find(decoration => decoration.outputClassName === 'style1'); }); // remove the first style added, which should only remove the output class cell.deltaCellDecorations(decorationIds, []); assert.ok(!cell.getCellDecorations().find(dec => dec.outputClassName === 'style1')); assert.ok(cell.getCellDecorations().find(dec => dec.className === 'style1')); assert.ok(!styleRemoved); assert.ok(outputStyleRemoved); }); }); }); </ins>