Open Tyriar opened 8 years ago
I wonder if we should do this before GA. Besides the summary, I also do not like that we have 2 folders, one for application data and one for extensions. Ideally we have one folder for both.
It was a little confusing when I was writing my script that automates my config to discover there were 2 config folders. If this is going to be done I vote for ~/.code[-<quality>]
so that it matches the executable name.
I am more worried about the migration than finding a name :)
I also don't get why there are two folders. Afaik .vscode
only includes one subfolder, extensions
. Why not simply put settings in .vscode
aswell?
I also like .vscode
more than .code
, Visual Studio stuff is also in .vs
and it is less ambiguous.
While fiddling with the config directories it might be worth tackling a portable version at the same time https://github.com/Microsoft/vscode/issues/329
Not for GA.
Btw the largest chunk of stuff in app date is created by Chrome itself and is used for local storage, index db, etc. It would be easy to migrate and move our settings out of that folder, I am worried about migrating the rest...
@bpasero what are your thoughts on getting this in for April? My experience with playing around with user data to date is that it seems fairly contained and can be moved without any issues.
The reason I want to do this soon is I'd like to have a set root user data dir as one is required to run under sudo
(https://github.com/Microsoft/vscode/issues/5561). That would mean that instead of:
~/.vscode
~/.config/Code
~/.config/Code-Root
We could have
~/.vscode
~/.vscode/user-data
~/.vscode/user-data-root
For migration something like this should work in main.js
:
if the regular config dir does not exists
if the old config dir does exist
copy the old config dir to the new location
@Tyriar happy to accept a PR on such a change and migration.
@Tyriar ah nice, did not see your PR until now!
Given my feedback, I am not suggesting to do this so late in the milestone.
@Tyriar any update on the current status? Thanks!
@sarbbottam still planned for May release.
Going to push back to July as I was too busy with Linux packaging improvements early this month.
eagerly waiting for this ... 🐱
Below is out of date, please see the top comment for the latest
So I'm going to move forward with this as:
<root_settings>/settings.json
<root_settings>/keybindings.json
<root_settings>/snippets/
<root_settings>/extensions/
<root_settings>/userdata/
<root_settings>/rootuserdata/
<root_settings>/workspaceStorage/
Where <root_settings>
is the parent of the [extension directory]:
%APPDATA%\Microsoft\Visual Studio Code[ - Variant]
$HOME/.vscode[- variant]
$HOME/.vscode[- variant]
* The folder name used is actually nameLong
from the product.json
(eg. Code - OSS
, Visual Studio Code
, Visual Studio Code - Insiders
, etc.)
\ The folder name used is actually dataFolderName
from the product.json
(eg. .vscode-oss
, .vscode
, .vscode-insiders
, etc.)
Related issues:
rootuserdata
directorycode
vs vscode
thing in this change.Here is the complete picture:
Old
Settings: %APPDATA%\Code[ - Variant]\User\settings.json
Keybindings: %APPDATA%\Code[ - Variant]\User\keybindings.json
Snippets: %APPDATA%\Code[ - Variant]\User\snippets\
Workspace storage: %APPDATA%\Code[ - Variant]\User\workspaceStorage\
Chromium user data: %APPDATA%\Code[ - Variant]\
Chromium root user data: (manually specified)
Extensions: %USERPROFILE%\.vscode[-variant]\extensions\
New
Note that %APPDATA%
is roaming and %LOCALAPPDATA%
is local, meaning extensions _will not_ be carried across multiple machines until a solution is devised for #7035.
Settings: %APPDATA%\Microsoft\[Visual Studio ]Code[ - Variant]\settings.json
Keybindings: %APPDATA%\Microsoft\[Visual Studio ]Code[ - Variant]\keybindings.json
Snippets: %APPDATA%\Microsoft\[Visual Studio ]Code[ - Variant]\snippets\
Workspace storage: %LOCALAPPDATA%\Microsoft\[Visual Studio ]Code[ - Variant]\workspaceStorage\
Chromium user data: %LOCALAPPDATA%\Microsoft\[Visual Studio ]Code[ - Variant]\userdata\
Chromium root user data: %LOCALAPPDATA%\Microsoft\[Visual Studio ]Code[ - Variant]\rootuserdata\
Extensions: %LOCALAPPDATA%\Microsoft\[Visual Studio ]Code[ - Variant]\extensions\
Old
Settings: $HOME/.config/Code[ - Variant]/User/settings.json
Keybindings: $HOME/.config/Code[ - Variant]/User/keybindings.json
Snippets: $HOME/.config/Code[ - Variant]/User/snippets/
Workspace storage: $HOME/.config/Code[ - Variant]/User/workspaceStorage/
Chromium user data: $HOME/.config/Code[ - Variant]/
Chromium root user data: (manually specified)
Extensions: $HOME/.vscode[-variant]/extensions/ (not moving)
New
Thanks to @ollie27 and others for calling out the XDG Base Directory Specification, see that document for fallbacks to the environment variables.
Settings: $XDG_CONFIG_HOME/[vs]code[-variant]/settings.json
Keybindings: $XDG_CONFIG_HOME/[vs]code[-variant]/keybindings.json
Snippets: $XDG_CONFIG_HOME/[vs]code[-variant]/snippets/
Workspace storage: $XDG_CACHE_HOME/[vs]code[-variant]/workspaceStorage/
Chromium user data: $XDG_CACHE_HOME/[vs]code[-variant]/userdata/
Chromium root user data: $XDG_CACHE_HOME/[vs]code[-variant]/rootuserdata/
Extensions*: $XDG_CACHE_HOME/[vs]code[-variant]/extensions/
* $XDG_DATA_HOME
may be a better candidate for extensions, my thinking is putting it in $XDG_CACHE_HOME
and eventually having an extensions.json
in $XDG_CONFIG_HOME
which details a list of extensions to be installed.
Old
Settings: $HOME/Library/Application Support/Code[ - Variant]/User/settings.json
Keybindings: $HOME/Library/Application Support/Code[ - Variant]/User/keybindings.json
Snippets: $HOME/Library/Application Support/Code[ - Variant]/User/snippets/
Workspace storage: $HOME/Library/Application Support/Code[ - Variant]/User/workspaceStorage/
Chromium user data: $HOME/Library/Application Support/Code[ - Variant]/
Chromium root user data: (manually specified)
Extensions: $HOME/.vscode[-variant]/extensions/ (not moving)
New
Settings: $HOME/Library/Application Support/[Visual Studio ]Code[ - Variant]/settings.json
Keybindings: $HOME/Library/Application Support/[Visual Studio ]Code[ - Variant]/keybindings.json
Snippets: $HOME/Library/Application Support/[Visual Studio ]Code[ - Variant]/snippets/
Workspace storage: $HOME/Library/Application Support/[Visual Studio ]Code[ - Variant]/workspaceStorage/
Chromium user data: $HOME/Library/Application Support/[Visual Studio ]Code[ - Variant]/userdata/
Chromium root user data: $HOME/Library/Application Support/[Visual Studio ]Code[ - Variant]/rootuserdata/
Extensions: $HOME/Library/Application Support/[Visual Studio ]Code[ - Variant]/extensions/
@Tyriar This was probably a typo within the GitHub reply and you may have already noticed this, but within the "complete picture" the snippets and extensions paths have been swapped for all platforms:
Snippets: %USERPROFILE%.vscode[-variant]\extensions\ Extensions: %LOCALAPPDATA%.vscode[-variant]\snippets\
Just making sure...
@QuietusPlus thanks, I posted a little early. I just fixed up a few issues including this one. I also changed the format of the Windows setting directory to match platform standards.
I'd appreciate any feedback on the above proposal. The main open questions I have currently are:
$HOME/Library/Application Support/Visual Studio Code[ - Variant]/
instead of $HOME/.vscode[-variant]
? (As per @joaomoreno's comment https://github.com/Microsoft/vscode/issues/7035#issuecomment-222618737, I'm using application support above)Should we take this opportunity to cull the 'vs' from .vscode[-variant]
in the open source builds? ie. change:
"dataFolderName": ".vscode-oss",
"win32MutexName": "vscodeoss", // This too?
to
"dataFolderName": ".code-oss",
"win32MutexName": "codeoss",
/cc @joaomoreno @bpasero @rebornix
Workspace storage: %APPDATA%\Microsoft\Visual Studio Code[ - Variant]\workspaceStorage\
Chromium user data: %APPDATA%\Microsoft\Visual Studio Code[ - Variant]\userdata\
Chromium root user data: %APPDATA%\Microsoft\Visual Studio Code[ - Variant]\rootuserdata\
What is in these folders? Can they grow unboundedly or are they basically just "settings" type things? If they can grow unboundedly (e.g., a cache folder, a build output directory, plugins folder, etc.) then they should probably go in %LOCALAPPDATA%
.
I'm curious why the names are different on Linux? In Linux, is there a convention to not use spaces in folder names? If so, then I support the difference.
Thanks @Zoltu, I changed user data folders to be %LOCALAPPDATA%
as they are Chromium's data dirs and contain a bunch of files. My Cache
directory inside the user data directory is 187mb for example. Workspace storage is just a few small json files. The only problem with this is that local storage will no longer roam, not sure all the implications of this but popups that the user told to not show again will show up again on a new machine.
In Linux for user-specific configurations it's common practice to keep them in a dir with a dot on the front which means they will be hidden by default. All lowercase with hyphens is also standard for files/folders on Linux.
Here is to hoping that the Chromium stuff behaves well when its folders randomly disappear between runs. :)
One thing I find weird is that you nest the Visual Studio Code
folder under a Microsoft
folder. The big Visual Studio simply installs to C:\Program Files\Microsoft Visual Studio
, I think VS Code should do it the same way (don't nest, but prefix).
I really really like this whole clean-up, especially with moving to appdata on Windows and dropping the User
folder (as this is already in the user's personal folder)
cc @Microsoft/vscode: please review @Tyriar's proposal
+100 for moving data from $HOME/.vscode*
to $HOME/Library/Application Support/Visual Studio Code*
.
Files and folders starting with a '.' are by default not visible in the OS X Finder and need special treatment when navigating into them whereas $HOME/Library/Application Support/
is just a normal folder (after making it visible once).
@felixfbecker I'm on my phone at the moment so finding a link is difficul but I believe that the Microsoft recommendation is to nest in a vendor folder (Microsoft
in this case). I believe Visual Studio (full) is doing it wrong by not nesting. There is an article on MSDN somewhere that specifies best practice for this stuff.
@Tyriar not sure if roaming is Windows only, but Workspace storage should be in local app data and not room. We don't room the workspace so additional data associated with a workspace in workspace storage shouldn't room either.
@dbaeumer thanks, moved workspace storage to %LOCALAPPDATA%
.
Another open question for @bpasero: what is %APPDATA%\Code - Insiders\storage.json
and why isn't that using localStorage? It just looks like yet another place for PC-specific settings to be dumped. Is this where localStorage is moving?
@Tyriar There are two other processes that don't have access to local storage: the main and the shared process.
I also have to suggest to not call workspaceStorage
but simply storage
. There is a need to have global storage that can be accessed globally, not just scoped by workspaces. Global storage currently is a big mess, but we should build a foundation upon which to proceed.
@joaomoreno but there is also a storage.json which will likely be going into the same folder as workspaceStorage.json. Cleaning up that side of things after this would be good.
Pushing out to August as the start of this month was largely spent gathering requirements. Please comment if you have any concerns with the direction before then.
This is getting pushed out beyond August due to relative low priority compared to my other issues.
On Linux I think we should continue to follow the XDG Base Directory Specification. So use $XDG_CONFIG_HOME
(~/.config/
), $XDG_CACHE_HOME
(~/.cache/
) and $XDG_DATA_HOME
(~/.local/share/
). I'm not completely sure how best to separate the directories but something like the following might work:
Settings: $XDG_CONFIG_HOME/vscode[-variant]/settings.json
Keybindings: $XDG_CONFIG_HOME/vscode[-variant]/keybindings.json
Snippets: $XDG_CONFIG_HOME/vscode[-variant]/snippets/
Workspace storage: $XDG_DATA_HOME/vscode[-variant]/workspaceStorage/
Chromium user data: $XDG_CACHE_HOME/vscode[-variant]/userdata/
Chromium root user data: $XDG_CACHE_HOME/vscode[-variant]/rootuserdata/
Extensions: $XDG_DATA_HOME/vscode[-variant]/extensions/
100% agree with ollie27. Dumping stuff in the home directory is bad. Please use XDG directories.
Well for Windows settings might get saved in the registry then instead 😄
Why is it being proposed to move away from the XDG Base Directory standard on Linux environments? I agree with @ollie27 .
@ollie27 $XDG_CONFIG_HOME
is not actually set on Ubuntu 16.04, where would you expect to be used in this case?
@Tyriar like is currently done (https://github.com/Microsoft/vscode/blob/746f66a6e7c164a6b920b439c23865f16b9a9b03/src/paths.js#L14) it would fall back to ~/.config
. The defaults are described on https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html.
I think we should use electron's app.getPath('appData')
which resolves to:
appData
Per-user application data directory, which by default points to:
%APPDATA%
on Windows$XDG_CONFIG_HOME
or ~/.config
on Linux~/Library/Application Support
on macOS@octref vscode defines that, the result of the discussion will determine what to set appData
as. https://github.com/Microsoft/vscode/blob/2f76c44632b0d47ba97f66fbc158c763628e30b3/src/paths.js#L10
Guys, I would like to vote to see this issue resolved . Specifically, having User/workspaceStorage being pulled from User.. This will enable users to share the same settings among multiple workstations using dropbox or similar cloud clients. Today this is hard to do because workspaceStorage takes hundreds of megabytes and it's also specific per workstation.
@romange there is an extension that syncs your settings and extensions.
@romange After the eventual change, settings.json
will still be a sibling of workspaceStorage
and the user data directory, etc. So that wouldn't help either. I suggest trying out the sync extension or writing some scripts to manage it yourself.
Thanks for the tip - using sync extension is great, thanks!
Would rather not use an extension - I have a system for syncing my stuff (especially configs inside XDG_CONFIG_HOME) and would prefer that it fits into that system. Also, glad that the conversation moved away from using the folder .code
- please, keep it .vscode
or something equally descriptive. We don't have namespaces here so it's up to application developers to be responsible.
I don't see why it wouldn't just use $XDG_CONFIG_HOME
if set and than fall back to the $HOME
, the way that Git and various other applications handle the situation.
I moved the proposal to the original issue comment and updated:
vs
and Visual Studio
may be optional depending on the build typeTo clarify, I would be happiest if my macOS also placed the configs into XDG_CONFIG_HOME if I set the variable.
If not, can there be custom environment variables so that I use to make my configs the same location on Linux and macOS?
XDG_CONFIG_HOME (and other xdg directory variables) is a neat way to make your apps behave more nicely cross-platform.
@jcrben you can already set this using the CLI:
--user-data-dir <dir> Specifies the directory that user data is kept
in, useful when running as root.
--extensions-dir <dir> Set the root path for extensions.
So you could do:
code --user-data-dir $XDG_CONFIG_HOME --extensions-dir $XDG_CONFIG_HOME
This will currently lump all files (even non-config files) into the directory though which may not be desirable. I'll call out in the original comment that the CLI will also need to be amended, we would definitely want to align with whatever the platform recommends by default though.
Note that Git respects XDG_CONFIG_HOME when set on macOS just fine - there is no disadvantage to respecting the environment variable if set.
I see that there's a CLI way to customize the location, but how about an an environment variable? That seems more typical and less clunky.
Config is stored in
~/.config/Code[ - <quality>]/User
. To match platform conventions (lowercase and hyphens for everything) as well as to keep consistency with the clicode[-<quality>]
I propose we change the settings directory one of:~/.config/code[-<quality>]/user
~/.vscode[-<quality>]
(see https://github.com/Microsoft/vscode/issues/3883)~/.code[-<quality>]
(to prevent using 'vs' showing up in the OSS build as it is now)If we moved this it would probably require some discovery/migration on first launch of a newer version.
The below is a living document.
Proposed folder structure
Notes:
code
vsvscode
thing in this change; only official builds should carry the visual studio branding, that should carry over to the config directories consistently as well.--user-data-dir
and--extensions-dir
will need to be adjusted for this, something like--config-dir
and--cache-dir
would probably be better.Windows
Old
New
Notes:
%APPDATA%
is roaming and%LOCALAPPDATA%
is local, meaning extensions will not be carried across multiple machines until a solution is devised for #15442. An extension manifest, eg.%APPDATA%\Microsoft\[Visual Studio ]Code[ - Variant]\extensions.json
which automatically installs extensions is my thinking of solving this problem.Linux
Old
New
Notes:
$XDG_CACHE_HOME
would be best for extensions provided there is an extensions manifest in$XDG_CONFIG_HOME
#15442.$XDG_DATA_HOME
?Mac
Old
New
Notes: