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

Default save / open location #115730

Closed
yoberner opened this issue Feb 4, 2021 · 56 comments · Fixed by #182908
Closed

Default save / open location #115730

yoberner opened this issue Feb 4, 2021 · 56 comments · Fixed by #182908
Assignees
Labels
feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders native-file-dialog Issues with native file dialog on-testplan
Milestone

Comments

@yoberner
Copy link

yoberner commented Feb 4, 2021

Would it be possible to change the default opening and saving location when trying to open and/or save a file.
For example, instead of it automatically being the root folder I would prefer the desktop.
Thanks!

@bpasero bpasero added dialogs Issues with native and custom dialogs feature-request Request for new features or functionality labels Feb 4, 2021
@bpasero bpasero removed their assignment Feb 4, 2021
@leighmcculloch
Copy link

leighmcculloch commented Dec 11, 2021

It would be helpful if it was also possible if this applies to opening folders too.

When using the File -> Open in VSCode on Mac the default folder to display is the home folder.

It would be convenient if there was a configuration open to change the default folder.

I keep all my code in a sub-directory of home, and it would be convenient if VSCode could be configured to default to that subdirectory.

This problem has been discussed prior in a few places, so it seems others are also interested in this capability:

@bpasero bpasero added native-file-dialog Issues with native file dialog and removed dialogs Issues with native and custom dialogs labels Feb 1, 2022
@thernstig
Copy link
Contributor

Similar issue everyone here might also want to upvote/support: #140358

@orinwalker
Copy link

Yes this would be very helpful!

@obsius
Copy link

obsius commented Mar 24, 2022

Would be super helpful and an extremely simple feature to implement.

@thernstig
Copy link
Contributor

Please consider upvoting #140358 otherwise it will be closed

@bpasero bpasero changed the title Default save location Default save / open location May 1, 2022
@trullock
Copy link

trullock commented May 1, 2022

This. Drives me mad!

@thernstig
Copy link
Contributor

#140358 has been fixed at least 😄

@silkfire
Copy link

silkfire commented May 2, 2022

I find this more useful. Hopefully it can be fixed in a near future.

@mackeyaj
Copy link

mackeyaj commented May 3, 2022

This would be extremely time saving!

@jjsekela
Copy link

Please 🥺

@serhiikartashov
Copy link

Please don't ignore this feature request :) It's useful.

@maxrks
Copy link

maxrks commented Jun 1, 2022

I think so, open folder in default location saving time.

@torext
Copy link

torext commented Jun 13, 2022

Yes, please implement this as it's a basic quality-of-life feature. Moreover, with the last update "Open Folder..." suddenly defaults to "Recent" on my Ubuntu installation and so it's even worse than the /home folder default it was before. Either don't touch defaults or, way better, make them user adjustable (as they should be).

@FedeAbella
Copy link

Just going to up @torext here: Last update on Ubuntu defaults Open Folder to Recent, which is a maddening headache for anyone trying to type their way into the appropriate folder (even if it is in the Recent items list). At the very least, keep it in /home/$USER

@gleacher
Copy link

Open Folder Recent is a disaster as Recent appears to be simply an arbitrary list of files that may have been edited at some time in the past. Even worse, the list is behind the editor, which must be moved to select the Default directory.

@FedeAbella
Copy link

@gleacher you mean the Open Folder window pops up in the background instead of above the editor window? God, I thought that was just me. It's incredibly annoying, and also started happening same time as it defaulted to Recent

@depascalis
Copy link

I only would like this behavior when opening a new empty window, not when I'm in a workspace or project.

Example
Open File/Folder from:

  1. Workspace/Project -> Current behavior (Optional of course)
  2. New empty window -> Get path from user specified settings.json

Also, consider support for these variable substitutions:
${userHome}, ${workspaceFolder}, ${fileWorkspaceFolder}, and ${env:MyEnvVar}. Did I miss any?

@FedeAbella
Copy link

FedeAbella commented Jun 20, 2022

Can't tell if there's been an update since the last comments on this, but Open Folder is now defaulting to ~ when no folder is open. It's defaulting to the open folder when one is already open (which I think makes sense)

The file dialog window is still sometimes popping up in the background though.

@zackwoo808
Copy link

zackwoo808 commented Jul 8, 2022

Temporary hack for MacOS users...

Follow the instructions to set up an Automator Service (now called Quick Action) here https://apple.stackexchange.com/questions/51481/quickly-open-your-favorite-folders-on-os-x#:~:text=In%20the%20sidebar%2C%20under%20'Library,you%20want%20a%20shortcut%20for.

BUT, for step 2, set the "in" variable to VSCode. And for step 5, make sure to also set the "Open with..." variable to VSCode.

Then follow the rest of the instructions for mapping this custom Service to a keyboard shortcut.

Now you can use this shortcut within VSCode to open a new window at your favorite directory each time, and from there when you open a file/folder, the "Open" dialogue will open in that directory.

@dani1113
Copy link

dani1113 commented May 2, 2023

👍

2 similar comments
@markict
Copy link

markict commented May 5, 2023

+1

@PCASME
Copy link

PCASME commented May 5, 2023

+1

@hym3242
Copy link

hym3242 commented May 12, 2023

+1, even having to edit it with defaults write is fine

@patrickmagee
Copy link

+1 would be great.

@gjsjohnmurray
Copy link
Contributor

I have submitted PR #182908 to address this.

@gjsjohnmurray
Copy link
Contributor

Pinging @bpasero because of his comment at #174228 (comment) in relation to a previous PR that was withdrawn by its author.

@bpasero
Copy link
Member

bpasero commented May 19, 2023

I am not entirely sure changing the fallback (which is currently user-home) to a custom folder solves the issue as reported. We may not use this fallback at all unless maybe you open an empty workspace and have no file opened?

@gjsjohnmurray
Copy link
Contributor

gjsjohnmurray commented May 19, 2023

I am not entirely sure changing the fallback (which is currently user-home) to a custom folder solves the issue as reported. We may not use this fallback at all unless maybe you open an empty workspace and have no file opened?

I think the majority of interest here is in the fallback case. For example, #115730 (comment) and following.

Still, I think it would be possible to enhance my PR so that the setting gets scoped as machine-overridable rather than machine, then use inspect() to make a workspace-level value override the current behaviour when a workspace (folder or .code-workspace) is open.

@trullock
Copy link

My 2p:

When i open VS it remembers where I was, this is good. When I do File->open it starts in the location of the folder/project thats open. Thats great.

When I do close folder, or otherwise open VS and there is nothing already open, I dont want it to start in c:/users/trullock, because never in my life has that ever been a working folder for anything

bpasero pushed a commit that referenced this issue Jun 26, 2023
* Implement `workbench.fileDialog.homePath` setting (fix #115730)

* Make it work with TestResolver remote

* Rename setting to `files.dialog.homePath`

* Add `preferredHome` to `IFileDialogService` so SimpleFileDialog can use it

* Improve setting description following feedback from @alexr00

* Ignore home override when doing ~ replacement

* Stop preferredHome falling back to user-local setting when working remote

* Eliminate preferredHome hack
@VSCodeTriageBot VSCodeTriageBot added the unreleased Patch has not yet been released in VS Code Insiders label Jun 26, 2023
@bpasero bpasero modified the milestones: Backlog, June 2023 Jun 26, 2023
@bpasero
Copy link
Member

bpasero commented Jun 26, 2023

Thanks to #182908, a new setting files.dialog.homePath allows to set the default path in contexts where we do not pick on the workspace or active file.

image

@silkfire
Copy link

Finally! 🚀

@gjsjohnmurray
Copy link
Contributor

Setting renamed to files.dialog.defaultPath in #186156 and will be available in tomorrow's Insiders.

gjsjohnmurray added a commit to gjsjohnmurray/vscode that referenced this issue Jun 26, 2023
…rosoft#182908)

* Implement `workbench.fileDialog.homePath` setting (fix microsoft#115730)

* Make it work with TestResolver remote

* Rename setting to `files.dialog.homePath`

* Add `preferredHome` to `IFileDialogService` so SimpleFileDialog can use it

* Improve setting description following feedback from @alexr00

* Ignore home override when doing ~ replacement

* Stop preferredHome falling back to user-local setting when working remote

* Eliminate preferredHome hack
@leighmcculloch
Copy link

leighmcculloch commented Jun 26, 2023

@bpasero @gjsjohnmurray Is there a way to set a home relative path in files.dialog.defaultPath? E.g. Can I set the value to $HOME/Code? Or ~/Code?

@bpasero
Copy link
Member

bpasero commented Jun 26, 2023

No, we do not support variables or path expansion in settings. though we have feature requests pending for that.

@VSCodeTriageBot VSCodeTriageBot added insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Jun 27, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Aug 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders native-file-dialog Issues with native file dialog on-testplan
Projects
None yet