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

Opening folder closes the opened files. #137414

Closed
ravitejapavuluri opened this issue Nov 18, 2021 · 9 comments · Fixed by #137475
Closed

Opening folder closes the opened files. #137414

ravitejapavuluri opened this issue Nov 18, 2021 · 9 comments · Fixed by #137475
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug file-explorer Explorer widget issues insiders-released Patch has been released in VS Code Insiders polish Cleanup and polish issue verified Verification succeeded
Milestone

Comments

@ravitejapavuluri
Copy link

Issue Type: Bug

steps to reproduce:
Open VSCode and open any few code files from your local machine.
Now go to explorer and open any folder.

expected:
all open files should remain open and folder also should open.
what actually happens:
all open files are closed and explorer opens a folder in the left pane.

VS Code version: Code 1.62.2 (3a6960b, 2021-11-11T20:51:30.084Z)
OS version: Linux x64 5.11.0-40-generic snap
Restricted Mode: No
Remote OS version: Linux x64 5.4.0-1045-aws

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz (8 x 1891)
GPU Status 2d_canvas: unavailable_software
gpu_compositing: disabled_software
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: disabled_off
rasterization: disabled_software
skia_renderer: enabled_on
video_decode: disabled_software
vulkan: disabled_off
webgl: unavailable_software
webgl2: unavailable_software
Load (avg) 1, 1, 1
Memory (System) 15.52GB (7.48GB free)
Process Argv --no-sandbox --force-user-env --unity-launch --crash-reporter-id c923c656-5d69-4b3c-b6a6-a0d2bc6a4c89
Screen Reader no
VM 0%
DESKTOP_SESSION ubuntu
XDG_CURRENT_DESKTOP Unity
XDG_SESSION_DESKTOP ubuntu
XDG_SESSION_TYPE wayland
Item Value
Remote SSH: athena
OS Linux x64 5.4.0-1045-aws
CPUs AMD EPYC 7571 (16 x 2537)
Memory (System) 61.71GB (4.59GB free)
VM 0%
@gjsjohnmurray
Copy link
Contributor

Does #79167 (comment) match what you are doing?

@gjsjohnmurray
Copy link
Contributor

@JacksonKearl maybe we should enhance the "NO FOLDER OPENED" assistance to be more helpful in this case. I prototyped this:

image

Or a less heavyweight alternative:

image

It uses the 'editorIsOpen' context key to add the extra text and the second command button. Only snag so far is that the context key is also true when non-text editors such as "Get Started" or "Settings" are open, as you'll see in my second screenshot above. I haven't found a context key that will avoid this.

Let me know if you'd like a PR from me.

@JacksonKearl
Copy link
Contributor

I like that second lighterweight version, cc @digitarald as he has been doing some investigations in the welcome views

@digitarald
Copy link
Contributor

Second version looks good.

Add Folder does behave a bit odd as it creates a multi-folder workspace and asks to save workspace config on close. As alternative solution: What about not closing loose files when a folder is opened? VS Code allows opening loose file when a folder is open as well, so why close them?

@gjsjohnmurray
Copy link
Contributor

@JacksonKearl @digitarald thanks for the feedback. I have submitted a PR implementing the second version.

@JacksonKearl
Copy link
Contributor

What about not closing loose files when a folder is opened? VS Code allows opening loose file when a folder is open as well, so why close them?

I'd like this too, cc @bpasero is this possible? It's always felt a bit odd that we make folks save their buffers before opening a folder, but I get that there's a lot of working copy logic going on behind the scenes.
image

@bpasero
Copy link
Member

bpasero commented Nov 19, 2021

I think this goes a little bit into the direction of being able to switch workspaces without that window reload we do. Ideally opening a folder would just add it to the explorer when previously the workbench was empty and then probably all view state is preserved. The interesting question is what should happen with the editors that were previously opened in that folder you now open? Should all editors merge?

We have an issue for that but I cannot find it.

@bpasero
Copy link
Member

bpasero commented Nov 19, 2021

#35109

@JacksonKearl JacksonKearl added bug Issue identified by VS Code Team member as probable bug file-explorer Explorer widget issues polish Cleanup and polish issue labels Dec 2, 2021
@JacksonKearl JacksonKearl added this to the November 2021 milestone Dec 2, 2021
JacksonKearl pushed a commit that referenced this issue Dec 2, 2021
* Improve Explorer welcome view (fix #137414)

* don't duplicate noFolder welcome help in the IsWebContext case

* simplify noFolderHelp when-clauses
@JacksonKearl
Copy link
Contributor

JacksonKearl commented Dec 2, 2021

Changed the explorer welcome view to be more explicit about this behaviour and provide a workaround. Thanks @gjsjohnmurray!

@tanhakabir tanhakabir added the verified Verification succeeded label Dec 2, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jan 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug file-explorer Explorer widget issues insiders-released Patch has been released in VS Code Insiders polish Cleanup and polish issue verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants
@digitarald @bpasero @gjsjohnmurray @JacksonKearl @tanhakabir @ravitejapavuluri and others