Repository: vscode
Issue: NotebookCellExecution.replaceOutput(...) appends output instead of replacing
Labels: bug,notebook-output

Type: <b>Bug</b>

In effect it will append the output similar to `appendOutput` but it appears to result in an additional `OutputItem`. Was this change intentional? The previous behavior can be somewhat mimicked calling `exec.clearOutput()` ahead of `exec.replaceOutput(...)`.

Behavior has changed starting with v1.75.0.

```
exec.replaceOutput([ new NotebookCellOutput([ item ]) ])
```

Before:
![image](https://user-images.githubusercontent.com/250527/217010454-1d4af7ac-b085-42c3-84b7-978260b0cbe3.png)

After:
![image](https://user-images.githubusercontent.com/250527/217010592-ff61f5ea-bdb8-4a8e-bba1-0de175c0c949.png)

VS Code version: Code 1.75.0 (Universal) (e2816fe719a4026ffa1ee0189dc89bdfdbafb164, 2023-02-01T15:24:42.903Z)
OS version: Darwin arm64 21.6.0
Modes:
Sandboxed: No

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Apple M1 Max (10 x 24)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: disabled_off<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>metal: disabled_off<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_renderer: enabled_on<br>video_decode: enabled<br>video_encode: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: disabled_off|
|Load (avg)|3, 4, 5|
|Memory (System)|64.00GB (7.24GB free)|
|Process Argv|--crash-reporter-id 7fb42086-e800-4f9a-95e5-3ed5c376b388|
|Screen Reader|no|
|VM|0%|
</details><details><summary>Extensions (37)</summary>

Extension|Author (truncated)|Version
---|---|---
tsl-problem-matcher|amo|0.6.2
vscode-eslint|dba|2.4.0
gitlens|eam|13.2.0
EditorConfig|Edi|0.16.4
prettier-vscode|esb|9.10.4
codespaces|Git|1.13.7
remotehub|Git|0.50.0
vscode-pull-request-github|Git|0.59.2023020215
gc-excelviewer|Gra|4.2.56
hcl|has|0.3.2
headwind|hey|1.7.0
vscode-docker|ms-|1.23.3
remote-containers|ms-|0.275.0
remote-ssh|ms-|0.96.0
remote-ssh-edit|ms-|0.84.0
remote-wsl|ms-|0.75.1
vscode-remote-extensionpack|ms-|0.23.0
azure-repos|ms-|0.26.0
hexeditor|ms-|1.9.11
remote-explorer|ms-|0.2.0
remote-repositories|ms-|0.28.0
vscode-github-issue-notebooks|ms-|0.0.128
sqltools|mtx|0.27.1
typescript-explorer|mxs|0.4.0
material-icon-theme|PKi|4.23.1
vscode-commons|red|0.0.6
vscode-yaml|red|1.11.0
synthwave-vscode|Rob|0.1.15
terrastate|roh|1.1.1
blueberry-cider|sf-|1.0.5
vscode-spotify|shy|3.2.1
marquee|sta|3.3.1669946006
runme|sta|0.5.1
stable|sta|0.8.1
rest-book|tan|6.2.1
vscode-mdx|uni|1.2.1
vim|vsc|1.24.3

(6 theme extensions excluded)

</details><details>
<summary>A/B Experiments</summary>

```
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vsdfh931cf:30280410
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593:30376534
pythonvs932:30410667
cppdebug:30492333
vscaac:30438847
vsclangdc:30486549
c4g48928:30535728
dsvsc012cf:30540253
azure-dev_surveyone:30548225
pyindex848:30577860
nodejswelcome1:30587005
3biah626:30602489
f6dab269:30613381
pythonsymbol12:30657548
a9j8j154:30646983

```

</details>

<!-- generated by issue reporter -->