Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[folding] remember across editor groups #198819

Closed
jpodpro opened this issue Nov 21, 2023 · 9 comments
Closed

[folding] remember across editor groups #198819

jpodpro opened this issue Nov 21, 2023 · 9 comments
Assignees
Labels
editor-folding Editor code folding issues feature-request Request for new features or functionality

Comments

@jpodpro
Copy link

jpodpro commented Nov 21, 2023

Type: Bug

Using a .js file (or probably any file type), code folding is not remembered when opening this file in a different split window. I would expect the last-changed folding state to persist across any opening of that file in VSCode and not only in the same split window (or when creating a new split from that file).

I create and remove splits and move files between them often as I'm assuming most devs do. But because VSCode doesn't save & open with a per-file fold state (it seems tied to the file and split somehow), the folding is almost never saved and usually opens with nothing folded. It is too easy to lose the folding state with basic use of VSCode and the result is having to re-fold my files nearly every time I open them which gives the feeling that "remember folding" does not really work in any meaningfully predictable way. There are multiple ways to reproduce this issue.

Method A:

  1. open .js file (file-1) and perform some folding
  2. open another file (file-2) and split that file right (ctrl /)
  3. with file-2 selected in the new right-side split, open file-1 here
  4. no folding from step 1 will appear

Method B:

  1. open .js file (file-1) and perform some folding
  2. open another file (file-2) and split that file right (ctrl /)
  3. starting from the left, close all open files one at a time. the last file to close should be file-2
  4. open file-1. no folding from step 1 will appear

VS Code version: Code 1.84.2 (1a5daa3, 2023-11-09T10:51:52.184Z)
OS version: Windows_NT x64 10.0.19045
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz (12 x 2592)
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) 63.86GB (45.33GB free)
Process Argv --crash-reporter-id 87a859a3-c325-4d8b-a115-19d73508136f
Screen Reader no
VM 0%
Extensions (17)
Extension Author (truncated) Version
Bookmarks ale 13.4.2
vscode-intelephense-client bme 1.10.1
vscode-eslint dba 2.4.2
githistory don 0.6.20
gitlens eam 14.5.0
duplicate gee 1.0.2
vscode-dotnet-runtime ms- 2.0.0
isort ms- 2023.10.1
python ms- 2023.20.0
jupyter ms- 2023.10.1100000000
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
vscode-commons red 0.0.6
vscode-xml red 0.26.1
intellicode-api-usage-examples Vis 0.2.8
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
vscoreces:30445986
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30410667
py29gd2263:30880072
vscaat:30438848
vsclangdc:30486549
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
282f8724:30602487
f6dab269:30613381
2i9eh265:30646982
showlangstatbar:30737416
pythonfmttext:30731395
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
pythonnosmt12:30797651
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30869155
dsvsc013:30795093
dsvsc014:30804076
dsvsc015:30845448
pythontestfixtcf:30871695
pythonregdiag2:30871582
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
pythontbext0:30879054
accentitlementsc:30887149
dsvsc016:30886110
dsvsc017cf:30886113
dsvsc018:30886114
aa_t_chat:30882232

@aeschli
Copy link
Contributor

aeschli commented Nov 22, 2023

I can reproduce this. Folding uses the editor view state to restore the folded ranges.
@bpasero Is the editor view state kept separate per editor group?

@bpasero
Copy link
Member

bpasero commented Nov 22, 2023

Yes, view state is per editor group. We will copy the state when you move or copy an editor over but from then on its separate.

@aeschli
Copy link
Contributor

aeschli commented Nov 22, 2023

Ok, so this as expected.

@aeschli aeschli changed the title Folding doesn't remember across split [folding] remember across editor groups Nov 22, 2023
@aeschli aeschli added editor-folding Editor code folding issues feature-request Request for new features or functionality labels Nov 22, 2023
@aeschli aeschli added this to the Backlog Candidates milestone Nov 22, 2023
@vscodenpa
Copy link

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@jpodpro
Copy link
Author

jpodpro commented Nov 23, 2023

From the product designer's perspective it works as intended and this is a feature request. From the product user's perspective this does not work as expected and feels like a bug. I can understand the challenge in walking this fine line especially with a popular product. At any rate I appreciate the consideration and hope to see this bug resolved as there are no other viable folding extensions that have helped prevent repetitively folding the same code sections.

@aeschli
Copy link
Contributor

aeschli commented Nov 23, 2023

There's a setting workbench.editor.sharedViewState that allows you to specify that editor state is shared across editor groups. Note that editor state is stored when an editor is closed or gets a new input.

It's a tricky issue. We want to allow that same file is opened in multiple groups and that each has its own folding state. So we need to manage the states separately per group, e.g. in case you do a reload. Maybe we can do better with the initial folding when an editor is opened for the very first time in a group.

@jpodpro
Copy link
Author

jpodpro commented Nov 23, 2023

With sharedViewState enabled it still seems occasionally unpredictable but it's a LOT better. Thanks for the tip!

@vscodenpa
Copy link

This feature request has not yet received the 20 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@vscodenpa
Copy link

🙁 In the last 60 days, this feature request has received less than 20 community upvotes and we closed it. Still a big Thank You to you for taking the time to create this issue! To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@vscodenpa vscodenpa closed this as not planned Won't fix, can't repro, duplicate, stale Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor-folding Editor code folding issues feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

4 participants