microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.76k stars 29.1k forks source link

In-file search does not reveal hidden unchanged regions #193834

Closed schonarth closed 2 months ago

schonarth commented 1 year ago

Type: Bug

Steps to reproduce:

  1. Configure Diff Editor to hide unchanged regions
  2. Open a file's diff so that parts of it will be hidden
  3. Ctrl/cmd+F and search for something that is in the hidden portions of the document

Expected result:

Actual result:

VS Code version: Code 1.82.2 (Universal) (abd2f3db4bdb28f9e95536dfa84d8479f1eb312d, 2023-09-14T05:59:47.790Z) OS version: Darwin arm64 22.5.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Apple M1 (8 x 24)| |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)|2, 3, 3| |Memory (System)|8.00GB (0.05GB free)| |Process Argv|--crash-reporter-id d4b76660-9f36-4272-adde-460b64a90944| |Screen Reader|yes| |VM|0%|
Extensions (81) Extension|Author (truncated)|Version ---|---|--- vscode-nvm|abu|0.0.1 Bookmarks|ale|13.4.1 vscode-css-modules|and|1.2.3 lit-html|bie|1.11.1 vscode-intelephense-client|bme|1.9.5 mermaid-markdown-syntax-highlighting|bpr|1.5.2 vscode-tailwindcss|bra|0.10.0 vscode-toggle-max-editor|cbu|0.0.2 js-auto-backticks|cha|1.0.0 path-intellisense|chr|2.8.4 package-json-upgrade|cod|2.1.0 meld-diff|dan|1.4.1 vscode-eslint|dba|2.4.2 xml|Dot|2.5.1 es7-react-js-snippets|dsz|4.4.3 gitlens|eam|14.3.0 vscode-html-css|ecm|1.13.1 EditorConfig|Edi|0.16.4 vscode-npm-script|eg2|0.3.29 prettier-vscode|esb|10.1.0 auto-close-tag|for|0.5.14 auto-rename-tag|for|0.1.10 copilot|Git|1.115.430 copilot-chat|Git|0.7.1 vscode-pull-request-github|Git|0.73.2023091209 vscode-graphql-syntax|Gra|1.2.2 json2ts|Gre|0.0.6 todo-tree|Gru|0.0.226 debug-visualizer|hed|2.4.0 output-colorizer|IBM|0.1.2 css-to-jss|inf|1.0.7 path-autocomplete|ion|1.25.0 vscode-peacock|joh|4.2.2 sftp|lix|1.12.10 ts-extension-pack|loi|0.3.0 call-graph|Luo|1.1.2 layout-editor|luv|0.0.1 camelcasenavigation|map|1.1.5 syntax-project-pbxproj|mar|0.1.3 git-graph|mhu|1.30.0 dotenv|mik|1.0.1 vscode-docker|ms-|1.26.1 vscode-kubernetes-tools|ms-|1.3.13 isort|ms-|2023.10.1 python|ms-|2023.16.0 jupyter|ms-|2023.8.1002501831 remote-containers|ms-|0.309.0 remote-ssh|ms-|0.106.4 remote-ssh-edit|ms-|0.86.0 remote-wsl|ms-|0.81.4 vscode-remote-extensionpack|ms-|0.24.0 powershell|ms-|2023.6.0 remote-explorer|ms-|0.4.1 remote-server|ms-|1.4.3 vsliveshare|ms-|1.0.5883 vscode-react-native|msj|1.12.0 sftp|Nat|1.16.3 back-n-forth|nic|3.1.1 fix-json|oli|0.1.2 tsimporter|pmn|2.0.1 vscode-css-peek|pra|4.4.1 vscode-thunder-client|ran|2.12.1 vscode-yaml|red|1.14.0 jsrelativeimport|rom|1.0.8 partial-diff|ryu|1.4.3 text-marker|ryu|1.11.0 svg-preview|Sim|2.8.3 diff-ui|sol|0.0.5 move-ts|str|1.12.0 vscode-editor-group-minimizer|suh|1.3.2 vscode-mermaid-editor|tom|0.19.1 vscode-mdx|uni|1.4.0 errorlens|use|3.13.0 highlight-matching-tag|vin|0.11.0 console-ninja|Wal|0.0.226 quokka-vscode|Wal|1.0.565 wallaby-vscode|Wal|1.0.370 vscode-todo-highlight|way|1.0.5 fig|wit|0.0.7 vscode-import-cost|wix|3.3.0 pretty-ts-errors|yoa|0.5.2
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vstes627:30244334 vslsvsres303:30308271 vserr242cf:30382550 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 282f8724:30602487 89544117:30613380 showlangstatbar:30737416 962ge761:30841074 a2ce3375:30757347 7ij38806:30736111 pythonfmttext:30731395 fixshowwlkth:30771522 showindicator:30805244 pythongtdpath:30769146 i26e3531:30792625 pythonnosmt12:30797651 pythonidxpt:30805730 pythonnoceb:30805159 copilotsettingc:30839828 synctok:30821570 dsvsc013:30795093 dsvsc014:30804076 diffeditorv2:30821572 dsvsc015:30829745 ```
adamsol commented 2 months ago

This seems to have been slightly improved recently, i.e. text is revealed, but together with potentially hundreds of other lines, which is impractical. I guess that only a small fragment of contextLineCount lines surrounding the text should be revealed instead.

The current behaviour can be reproduced in the Monaco Playground.

hediet commented 2 months ago

but together with potentially hundreds of other lines, which is impractical

I'm not sure if any other diff editor offers such functionality.

adamsol commented 2 months ago

For clarity, currently the effect in my example is like this:

current

And what one would most probably expect is this:

expected

Since the whole folding machinery is already in place, I thought it would be an easy fix to reveal just the small fragment around the text instead of those large sections. But if for some reason it's more complicated and the current behaviour is on purpose, then I guess this issue can just be closed, as the original problem seems to be resolved.

hediet commented 2 months ago

@adamsol can you create a new issue/feature request? I like the idea, but it is not trivial.