vscode: Diff Inline View is not showing removed code

Type: Bug

  1. Open a file that is stored in source control.
  2. Remove some text from it.
  3. In the “Source Control” menu, select the file to open the diff and see the changes.
  4. Toggle between Split View and Inline View. Split View shows the deleted text, while Inline View does not. The minimap scrollbar shows red though, indicating it sees the removed code.

VS Code version: Code 1.82.1 (6509174151d557a81c9d0b5f8a5a1e9274db5585, 2023-09-08T08:45:05.575Z) OS version: Windows_NT x64 10.0.19045 Modes:

System Info
Item Value
CPUs Intel® Core™ i7-10875H CPU @ 2.30GHz (16 x 2304)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 31.72GB (15.89GB free)
Process Argv –crash-reporter-id e8c746cd-ffb1-4751-aa20-daae247bf885
Screen Reader no
VM 0%
Extensions (136)
Extension Author (truncated) Version
better-comments aar 3.0.2
codesnap adp 1.3.4
Bookmarks ale 13.4.1
arepl alm 2.0.5
jsoncrack-vscode Ayk 2.0.2
armview ben 0.4.6
github-markdown-preview bie 0.3.0
markdown-checkbox bie 0.4.0
markdown-emoji bie 0.3.0
markdown-footnotes bie 0.1.1
markdown-mermaid bie 1.19.0
markdown-preview-github-styles bie 2.0.2
markdown-yaml-preamble bie 0.1.0
insert-unicode bru 0.14.0
vscode-better-align cho 1.4.2
npm-intellisense chr 1.4.4
gitignore cod 0.9.0
supersharp cra 0.1.4
vscode-markdownlint Dav 0.51.0
vscode-eslint dba 2.4.2
githistory don 0.6.20
xml Dot 2.5.1
gitlens eam 14.3.0
sort-lines-by-selection ear 1.2.0
vscode-html-css ecm 1.13.1
EditorConfig Edi 0.16.4
LogFileHighlighter emi 2.16.0
json-tools eri 1.0.2
file-icons fil 1.1.0
vscode-firefox-debug fir 2.9.8
auto-close-tag for 0.5.14
auto-rename-tag for 0.1.10
code-runner for 0.12.0
copilot Git 1.111.404
copilot-chat Git 0.7.0
copilot-labs Git 0.15.1019
remotehub Git 0.60.0
vscode-github-actions git 0.26.2
vscode-pull-request-github Git 0.72.0
go gol 0.39.1
gc-excelviewer Gra 4.2.58
terraform has 2.27.2
vscode-test-explorer hbe 2.21.1
vscode-drawio hed 1.6.6
randomeverything hel 0.0.3
yaml-plus-json hil 1.12.1
rest-client hum 0.25.1
path-autocomplete ion 1.25.0
vscode-hacker-typer jev 0.1.1
azure-policy-intellisense jus 0.0.9
vscode-colorize kam 0.11.1
vsc-python-indent Kev 1.18.0
vscode-gutter-preview kis 0.30.0
regexp-preview Lou 0.1.5
vscode-autohotkey-plus-plus mar 5.0.3
rainbow-csv mec 3.7.0
git-graph mhu 1.30.0
dotenv mik 1.0.1
azure-pipelines ms- 1.208.0
azure-dev ms- 0.7.0
vscode-apimanagement ms- 1.0.8
vscode-azureappservice ms- 0.25.0
vscode-azurecontainerapps ms- 0.5.1
vscode-azurefunctions ms- 1.12.4
vscode-azureresourcegroups ms- 0.7.5
vscode-azurestaticwebapps ms- 0.12.2
vscode-azurestorage ms- 0.15.3
vscode-azureterraform ms- 0.3.2
vscode-azurevirtualmachines ms- 0.6.5
vscode-bicep ms- 0.21.1
vscode-cosmosdb ms- 0.19.4
vscode-docker ms- 1.26.0
blazorwasm-companion ms- 1.1.4
csdevkit ms- 0.4.10
csharp ms- 2.2.10
dotnet-interactive-vscode ms- 1.0.4461040
vscode-dotnet-runtime ms- 1.7.2
vscodeintellicode-csharp ms- 0.1.26
vscode-kubernetes-tools ms- 1.3.13
data-workspace-vscode ms- 0.5.0
mssql ms- 1.20.1
sql-bindings-vscode ms- 0.4.0
sql-database-projects-vscode ms- 1.2.0
isort ms- 2023.10.1
python ms- 2023.16.0
vscode-pylance ms- 2023.9.10
jupyter ms- 2023.8.1002501831
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.0.17
vscode-jupyter-cell-tags ms- 0.1.8
vscode-jupyter-slideshow ms- 0.1.5
remote-containers ms- 0.309.0
remote-ssh ms- 0.106.4
remote-ssh-edit ms- 0.86.0
remote-wsl ms- 0.81.3
vscode-remote-extensionpack ms- 0.24.0
azure-account ms- 0.11.5
azure-repos ms- 0.36.0
azurecli ms- 0.5.0
powershell ms- 2023.6.0
remote-explorer ms- 0.4.1
remote-repositories ms- 0.38.1
remote-server ms- 1.4.3
test-adapter-converter ms- 0.1.8
vscode-node-azure-pack ms- 1.2.0
azurerm-vscode-tools msa 0.15.11
gremlins nho 0.26.0
deepdark-material Nim 3.3.1
autodocstring njp 0.6.1
indent-rainbow ode 8.3.1
advanced-new-file pat 1.2.2
git-file-history pom 1.0.1
vscode-css-peek pra 4.4.1
pester-test psp 2023.7.7
puppet-vscode pup 1.4.0
quicktype qui 12.0.46
ruby reb 0.28.1
vscode-commons red 0.0.6
vscode-yaml red 1.14.0
shopify-liquid sis 3.2.2
runme sta 1.10.0
code-spell-checker str 3.0.1
azure-devops-yaml-pipeline-validator Tom 1.8.0
vscode-inline-values-powershell Tyl 0.0.7
vscode-mdx uni 1.4.0
errorlens use 3.13.0
highlight-matching-tag vin 0.11.0
intellicode-api-usage-examples Vis 0.2.8
vscodeintellicode Vis 1.2.30
codetour vsl 0.0.59
gistfs vsl 0.4.1
vscode-ruby win 0.28.0
vscode-import-cost wix 3.3.0
change-case wma 1.0.0
markdown-all-in-one yzh 3.5.1
vscode-autohotkey-debug zer 1.11.0
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
py29gd2263cf:30792227
vsclangdf:30486550
c4g48928:30535728
dsvsc012:30540252
pynewext54:30695312
azure-dev_surveyone:30548225
vsccc:30803844
3biah626:30602489
f6dab269:30613381
showlangstatbar:30737416
0bi6i642:30835152
03d35959:30757346
pythonfmttext:30731395
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
pythonnosmt12:30797651
pythonidxptcf:30805731
pythonnoceb:30805159
copilotsettingt:30834058
dsvsc013:30795093
dsvsc014:30804076
diffeditorv2:30821572
dsvsc015cf:30829746

Screenshots

Here is the Split View diff, where you can see that code was removed: image

And here is the Inline View, which would normally show the removed text, but no longer does: image

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Reactions: 20
  • Comments: 26 (6 by maintainers)

Most upvoted comments

I have this issue in the latest vscode version

FYI this has appeared for me now in latest release.

The bug does not appear immediately on vscode application launch. Have not noticed any specific action triggering it, but will keep an eye out.

Version: 1.83.1 (user setup) Commit: f1b07bd25dfad64b0167beb15359ae573aecd2cc Date: 2023-10-10T23:48:05.904Z Electron: 25.8.4 ElectronBuildId: 24154031 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Windows_NT x64 10.0.19044

@hediet Time-correlated renderer.log entries when something that looked like this issue re-occurred (except showing only the removal, not the addition) just a bit ago… hope this provides a hint at what might be going on.

2023-11-22 13:38:00.272 [error] Cannot read properties of undefined (reading 'endLineNumberExclusive'): TypeError: Cannot read properties of undefined (reading 'endLineNumberExclusive')
    at E.intersectsStrict (vscode-file://vscode-app/c:/Users/me/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:96:10545)
    at D (vscode-file://vscode-app/c:/Users/me/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:681:45393)
    at vscode-file://vscode-app/c:/Users/me/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:681:47301
    at w (vscode-file://vscode-app/c:/Users/me/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:85:8256)
    at vscode-file://vscode-app/c:/Users/me/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:681:47296
2023-11-22 13:38:45.797 [error] Cannot read properties of undefined (reading 'endLineNumberExclusive'): TypeError: Cannot read properties of undefined (reading 'endLineNumberExclusive')
    at E.intersectsStrict (vscode-file://vscode-app/c:/Users/me/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:96:10545)
    at D (vscode-file://vscode-app/c:/Users/me/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:681:45393)
    at vscode-file://vscode-app/c:/Users/me/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:681:47301
    at w (vscode-file://vscode-app/c:/Users/me/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:85:8256)
    at vscode-file://vscode-app/c:/Users/me/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:681:47296
2023-11-22 13:38:56.498 [error] Cannot read properties of undefined (reading 'endLineNumberExclusive'): TypeError: Cannot read properties of undefined (reading 'endLineNumberExclusive')
    at E.intersectsStrict (vscode-file://vscode-app/c:/Users/me/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:96:10545)
    at D (vscode-file://vscode-app/c:/Users/me/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:681:45393)
    at vscode-file://vscode-app/c:/Users/me/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:681:47301
    at w (vscode-file://vscode-app/c:/Users/me/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:85:8256)
    at vscode-file://vscode-app/c:/Users/me/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:681:47296
2023-11-22 13:40:04.384 [error] Cannot read properties of undefined (reading 'endLineNumberExclusive'): TypeError: Cannot read properties of undefined (reading 'endLineNumberExclusive')
    at E.intersectsStrict (vscode-file://vscode-app/c:/Users/me/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:96:10545)
    at D (vscode-file://vscode-app/c:/Users/me/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:681:45393)
    at vscode-file://vscode-app/c:/Users/me/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:681:47301
    at w (vscode-file://vscode-app/c:/Users/me/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:85:8256)
    at vscode-file://vscode-app/c:/Users/me/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:681:47296

Edit to add: One other thing I observe is the only-shows-deleted behavior seems to happen on the second or later Replace (Ctrl+Shift+1) operation in the same file. Clicking a find result in a different file and then clicking back to the offending file seems to “reinitialize” things into a working state that shows the addition and removal as expected.

Edit to add again: This seems to be happening in the Replace Preview editor today. I’m not sure how to judge whether what I’m seeing today is related to the original issue or not since it’s similar squirrely behavior in diffing. Sorry if this is in fact a distinct issue.

Nevermind, I think your fix didn’t go to release yet

Version: 1.84.2 (user setup) Commit: 1a5daa3a0231a0fbba4f14db7ec463cf99d7768e Date: 2023-11-09T10:51:52.184Z Electron: 25.9.2 ElectronBuildId: 24603566 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Windows_NT x64 10.0.22631

This actually might be a duplicate of https://github.com/microsoft/vscode/issues/198516 which I already fixed last week in insiders. Thanks so much @JoshHarmon for the log! That was super helpful to track this down.

@hediet this is most consistently happening to me when I’m viewing worktree diff, then staging it in the sidebar. It happens randomly, but I noticed this is what I was usually doing just before it does.

I have to Reload Window each time it happens to fix the issue, until it re-occurs sometime later.

Can you check/share the dev tool logs when this happens? Can you also share both sides of the diff where this happens?

I’m using the diff editor daily and so far I didn’t see this yet.

Another quick fix/workaround is to run > Developer: Reload Window from the Command Pallete. @ahkhanjani try that maybe?

toggling the Diff Editor: Render Side By Side setting on and off worked for me

image

Somewhere in the middle of coding VS Code suddenly decides to do this. Closing and reopening VS Code fixes it temporarily until this happens again. That’s my current unsophisticated observation. (v1.83.1)